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 ...
随机推荐
- 新浪 股票 API
新浪期货数据接口 [例子]http://hq.sinajs.cn/list=M0豆粕连续 M0 返回值如下:var hq_str_M0="豆粕连续,145958,3170,3190,3145 ...
- php 备份数据库
<?php header("Content-type:text/html;charset=utf-8"); //配置信息 $cfg_dbhost = 'loca ...
- 2015 Multi-University Training Contest 6
1001 Average 忍不住又补了一题. 只要枚举1与2之间1给2,2给1,什么都不做三种状态. 后面的情况都已经决定了. (估计只有我比赛的时候把a candy当成a个糖果了吧QAQ) # in ...
- 搭建localhost的目录环境
.打开系统盘,默认是C:\Windows\System32\drivers\etc,如果系统盘是D盘就打开D:\Windows\System32\drivers\etc: .用记事本打开hosts: ...
- Cross compile openwrt
在Centos7上交叉编译生成OpenWrt固件 安装ss-* 获取最新的ss, 当前是 wget https://github.com/shadowsocks/shadowsocks-libev/a ...
- mvn 下载源码和javadoc
1. 下载源码,两种: . mvn dependency:sources . mvn eclipse:eclipse -DdownloadSources=true 2. 下载javadoc,两种: . ...
- Linux 系统监控
*lsof 列出打开的文件 常用 lsof -i:8080*htop进程监控iotop(bugs)iptraf实时局域网IP监控psacct 监视用户活动monit Linux进程和服务监控工具* ...
- ubuntu 连接VPN 命令
1 注册MXVPN 2 启动VPN pptpsetup --create mxvpn1 --server xx.xx.xx.xx --username *** --password *** --e ...
- xib storyboard
initWithNibName加载xib或者storyboard BLEViewController *controller = [[BLEViewController alloc] initWith ...
- PHP之输出控制 ob_start(),ob_get_contents(),ob_end_clean()
1.常用函数 ob_start();#打开输出缓冲区 ob_get_contents();#获取缓冲区内容 ob_get_length();#获取缓冲区内容长度 ob_clean();#清除之前的所有 ...