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. phpstudy 相关配置

    在/etc/my.cnf中 添加 expire_logs_days=5 phpstudy add   list    del

  2. MySQL-MHA高可用方案

    http://files.cnblogs.com/jimingsong/mha-mysql.pdf 此方案为一号店MySQL MHA高可用方案.备注.

  3. 杭电21题 Palindrome

    Problem Description A palindrome is a symmetrical string, that is, a string read identically from le ...

  4. 华为配置SSH登陆详细步骤

    理解下SSH登录的过程: 1.建立目的端口为22的TCP连接 2.协商SSH版本 3.协商密钥和算法 4.会话建立 下面为server端的详细配置步骤: 1.创建本地RSA密钥对 rsa local- ...

  5. iOS10访问用户权限的描述key值汇总

    https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Ar ...

  6. mac 文件路径问题

    Finder栏显示访问路径 操作步骤: 打开“终端”(应用程序->实用工具),输入以下两条命令: defaults write com.apple.finder _FXShowPosixPath ...

  7. C语言语法tips(不断更新)

    语法虽然琐碎,犯了低级错误代价可就大了,列出一些容易混淆概念,避免以后出错 sizeof和strlen的区别在于:1.sizeof是运算符,语言支持的,strlen可以求malloc出来的字符串的长度 ...

  8. 修改jsonb的属性

    CREATE FUNCTION jsonb_merge(JSONB, JSONB) RETURNS JSONB AS $$ WITH json_union AS ( SELECT * FROM JSO ...

  9. 九、oracle 事务

    一.什么是事务事务用于保证数据的一致性,它由一组相关的dml语句组成,该组的dml(数据操作语言,增删改,没有查询)语句要么全部成功,要么全部失败.如:网上转账就是典型的要用事务来处理,用于保证数据的 ...

  10. linux中tar 打包指定路径文件

    linux中tar打包指定路径文件www.111cn.net 编辑:yahoo 来源:转载在linux系统中打包与解压文件我都可以使用tar命令来解决,只要使用不同的参数就可以实现不同的需要了,下面来 ...