Windows Batch Scripts
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的更多相关文章
- CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台
所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...
- Windows batch,echo到文件不成功,只打印出ECHO is on.
jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...
- windows batch语法
windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...
- 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 ...
- 深入浅出Windows BATCH
1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...
- jenkins 如何处理windows batch command
这两天一直被一个问题困扰. 在jenkins的windows batch command 测试好的,拿到bat文件中,再从Execute Windows Batch command 中调用这个bat, ...
- Build step 'Execute Windows batch command' marked build as failure
坑爹的Jenkis,在执行windows命令编译.NET项目的时候命令执行成功了,但是却还是报了这样一个错: Build step 'Execute Windows batch command' ma ...
- Windows Batch 编程 和 Powershell 编程
Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...
- Batch - Windows Batch 常用命令
比较符号(不能用 < , >) The reason operators like > are not used is because they have special meani ...
随机推荐
- mysql、sqlserver数据库常见数据类型对应java中的的类型探究
由于本次测试表的结构不涉及到主键的自增长,所以mysql.sqlserver建表语句相同: CREATE TABLE testType ( id INT NOT NULL DEFAULT 0, gen ...
- Process 'command '/usr/lib/jvm/jdk1.8.0_25/bin/java'' finished with non-zero exit value 2
这个问题有两种可能,第一是jar包或者依赖冲突(版本冲突也算).第二是65535. 对于65535的问题,请看http://blog.csdn.net/t12x3456/article/details ...
- java中的静态代码块等执行顺序
http://www.cnblogs.com/naruto469/p/3608459.html public class Print { 2 3 public Print(String s){ 4 S ...
- Broken Keyboard(悲剧文本)
你有一个键盘,键盘上所有的键都能正常使用,只是Home键和End键有时会自动按下.你并不知道这一情况,而是专心地打稿子,甚至连显示器都没开电源.当你打开显示器之后,展现在你面前的是一段悲剧文本.你的任 ...
- LeetCode OJ 223.Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined b ...
- HDU2673:shǎ崽 OrOrOrOrz
Problem Description Acmer in HDU-ACM team are ambitious, especially shǎ崽, he can spend time in Inter ...
- Java良葛格 学习笔记《二》
正则表达式 . 符合任一字符\d 符合0到9任一个数字字符\D 符合0-9以外的字符\s 符合'\t'.'\n'.'\x0B'.'\f'.'\r'等空格符\w 符合a到z.A到Z.0到9等字符,也就是 ...
- 初识beego
beego是一个基于golang的web框架,这里记录些使用中碰到的东西. 输出: this.Ctx.Output.Write([]byte("test")) //这里是作为res ...
- CentOS7 PostgreSQL 主从配置( 二)
同步流复制配置PostgreSql的流复制是异步的,缺点是Standby上的数据落后于主库上的数据,如果使用Hot Standby做读写分离,就会存在数据一致性的问题.PostgreSql9.1版本后 ...
- 百度前端面试题-类似slack的在线聊天室
别人国庆出去玩,我在家写代码的感觉也是很不错哒. 首先介绍一下技术架构吧! 使用了js框架:FFF,zepto,jquery,md5.min.js 前端框架:Bootstrap 后端:野狗,部分PHP ...