Tips for Bat

打开文件夹

1
start F:/Folder/

设置变量

注意在设置变量时不要在变量名和变量值直接加空格,SET foo = bar 是错误的,应该是 SET foo=bar

1
2
3
4
5
echo off
set var=1
echo %var%

set image_%%05d

The /A switch supports arthimetic operations during assigments. This is a useful tool if you need to validated that user input is a numerical value.

1
2
SET /A four=2+2
4

注释

REM或者 ::都可以注释!

1
2
REM this is a comment!
:: This is also a conment!

参考