随笔分类 -  批处理

摘要: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 阅读全文
posted @ 2017-03-17 11:28 xiongjiawei 阅读(999) 评论(0) 推荐(0)
摘要:echo. 阅读全文
posted @ 2017-03-17 10:39 xiongjiawei 阅读(1336) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-03-17 09:35 xiongjiawei 阅读(5846) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-03-14 19:55 xiongjiawei 阅读(402) 评论(0) 推荐(0)