本帖最后由 老刘1号 于 2017-6-29 15:27 编辑
回复 7# zhaofeng0420
修复了双引号问题- :zt1
- echo.
- SET Choice=
- echo #三个选择
- SET /P Choice=------》
- echo.
- set "Choice=%Choice:~,1%"
- IF "%Choice:"=""%" EQU "1" GOTO a
- IF "%Choice:"=""%" EQU "2" GOTO b
- IF "%Choice:"=""%" EQU "3" GOTO c
- echo 输入有误,请重新输入
- goto zt1
复制代码 不就只输一位嘛
改进版(xcopy获取单个输入来自:http://www.bathome.net/thread-41643-1-1.html)- :zt1
- echo.
- SET Choice=
- echo #三个选择
- for /f "delims=" %%a in ('xcopy /w . . 2^>nul') do if not defined Choice set "Choice=%%a"
- echo.
- set "Choice=%Choice:~-1%"
- IF "%Choice:"=""%" EQU "1" GOTO a
- IF "%Choice:"=""%" EQU "2" GOTO b
- IF "%Choice:"=""%" EQU "3" GOTO c
- echo 输入有误,请重新输入
- goto zt1
复制代码 输入123才能退出 |