标题: [系统相关] 批处理怎样根据用户输入来选择执行不同的命令? [打印本页]
作者: winfly 时间: 2010-10-1 22:42 标题: 批处理怎样根据用户输入来选择执行不同的命令?
比如说我要做个服务优化批处理,
您的计算机是否需要开启声音输出服务?
1.开启 2.关闭
set /p a=
后面怎么写呢?
作者: hfg1977 时间: 2010-10-2 00:28
- :start ============================================================
- echo 您的计算机是否需要开启声音输出服务?
- echo 1.开启 2.关闭
- set "choice="&set/p choice=输入你的选择(1/2/q):
- if /i "%choice%"=="q" goto end
- echo %choice%|findstr "^[12]$">nul 2>nul&&goto choice%choice%
- goto end
- :choice1
- sc config AudioSrv start= AUTO
- goto end
- :choice2
- sc config AudioSrv start= DISABLED
-
- :end ==============================================================
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |