随笔分类 - 批处理
摘要:如题
阅读全文
摘要:1 @echo off 2 set sum=0 3 call :sub sum 1 2 3 4 4 echo sum=%sum% 5 pause 6 7 :sub 8 set /a %1=%1+%2 9 shift /2 10 if not "%2"=="" goto sub 11 goto :eo
阅读全文
摘要:1 @echo off 2 set /p str=请输入任意长度字符串: 3 if not defined str goto :eof 4 echo 您输入了:%str% 5 set num=0 6 :label 7 set /a num+=1 8 set str=%str:~0,-1% 9 if
阅读全文
摘要:1 @echo off 2 dir d:\dddddd 3 4 if errorlevel 1 goto 1 5 if errorlevel 0 goto 0 6 rem 两行if语句不可交换位置,否则失败了也会显示成功。 7 8 :0 9 echo 命令执行成功 10 goto exit 11 1
阅读全文