Some simple examples:

simple.bat

@echo off
set _var1=3
set _var2=5
set /a _result=%_var1%+%_var2%
echo Result is %_result%
mult.bat

@echo off
if "%1" == "" goto :help
if "%2" == "" goto :help
set /a result=%1 * %2
echo Result is %result%
goto :eof :help
echo Usage: mult X Y (Multiply X by Y)
power.bat

@echo off
if "%1" == "" goto :help
if "%2" == "" goto :help
set _result=%1
for /L %%G in (2,1,%2) do set /a "_result*=%1"
echo %1 to the power of %2 is %_result%
goto :eof :help
echo Usage: power X Y (Calculate X to the power of Y.)
functions.bat

@echo off
set /p _num1=Number1:
set /p _num2=Number2:
call :plusfunc %_num1% %_num2%
call :output
call :subfunc %_num1% %_num2%
call :output
goto :eof :plusfunc
setlocal
set /a _num1=%1 + %2
endlocal & set _result=%_num1%
goto :eof :subfunc
setlocal
set /a result=%1 - %2
endlocal & set _result=%result%
goto :eof :output
echo Result is %_result%
goto :eof

Windows Batch Scripts的更多相关文章

  1. CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台

    所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...

  2. Windows batch,echo到文件不成功,只打印出ECHO is on.

    jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...

  3. windows batch语法

    windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...

  4. Use windows batch script to create menu

    Background Recently, I find that we need  to  type some very long gradle commands to run build, chec ...

  5. 深入浅出Windows BATCH

    1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...

  6. jenkins 如何处理windows batch command

    这两天一直被一个问题困扰. 在jenkins的windows batch command 测试好的,拿到bat文件中,再从Execute Windows Batch command 中调用这个bat, ...

  7. Build step 'Execute Windows batch command' marked build as failure

    坑爹的Jenkis,在执行windows命令编译.NET项目的时候命令执行成功了,但是却还是报了这样一个错: Build step 'Execute Windows batch command' ma ...

  8. Windows Batch 编程 和 Powershell 编程

    Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...

  9. Batch - Windows Batch 常用命令

    比较符号(不能用 < , >) The reason operators like > are not used is because they have special meani ...

随机推荐

  1. webservice整合spring

    接口HelloWorld需要添加webservice注解 package com.cs.webservice; import java.util.List; import javax.jws.WebP ...

  2. 怎样正确设置remote_addr和x_forwarded_for

    怎样正确设置remote_addr和x_forwarded_for 2013-04-20 做网站时经常会用到remote_addr和x_forwarded_for这两个头信息来获取客户端的IP,然而当 ...

  3. .Net_把文件数据添加到数据库中(面试题)

    一个文本文件含有如下内容: 4580616022644994|3000|赵涛 4580616022645017|6000|张屹 4580616022645090|3200|郑欣夏 上述文件每行为一个转 ...

  4. HTML+CSS Day11产品网站

    1.佰亿首页 效果图: 代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ht ...

  5. linux yum安装mongodb

    1.yum -y install mongodb-server  mongodb 2.service mongod start                     #启动mongodb 服务 3. ...

  6. HDU3371--Connect the Cities(最小生成树)

    Problem Description In 2100, since the sea level rise, most of the cities disappear. Though some sur ...

  7. 框架基础:ajax设计方案(二)---集成轮询技术

      上一篇文章介绍了ajax技术核心方法,和跨域的问题(只要后台支持跨域默认post就可以),这篇文章讲解一下使用ajax实现的轮询技术,至于iframe,SSE服务器单向推送,以及webSocket ...

  8. 能加载文件或程序集“XXX”或它的某一个依赖项,系统找不到指定的文件

    能加载文件或程序集“XXX”或它的某一个依赖项,系统找不到指定的文件 http://blog.csdn.net/pplcheer/article/details/7796211 做项目总是遇到各种的问 ...

  9. MFC中实现定时执行与提醒功能(自编代码)

    具体实现代码如下:添加一个计时器:SetTimer(1,1000,NULL); 下面仅列举核心代码,详细步聚不作说明,效果如下所示: void CShowTimer::OnTimer(UINT_PTR ...

  10. leetcode70

    You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...