Batch tips,
ide
for /f參數用法:
1.1 "delims=*"等號左右空格是有意義的。
1.2 option的默認參數是"delims= ",故默認參數狀況一下,讀一行參數遇到空格就不讀了。須要把整行讀完的話,咱們能夠使delims的參數爲最後結尾的字符。ip
set參數小結:
2.1 set i="abc" 給i賦值字符串。如:
set i="abc"
echo %i%
if %i%=="abc" (echo equal to abc) else (echo don't equal to abc)
2.2 set /a i=123 給i賦值數字
2.3 set /p i=請輸入 爲i輸入一個值,默認輸入的是數字,若是是要當字符串用,須要調用變量的時候i兩邊須要加""如:
3.3 set /p i=Please told me your options:
echo %i%
if "%i%"=="a" (goto addpatch) else (goto installpatch)
:addpatch
echo add patch
goto :eof
:installpatch
echo install patch
goto :eofci