Board logo

标题: [系统相关] 批处理怎样根据用户输入来选择执行不同的命令? [打印本页]

作者: winfly    时间: 2010-10-1 22:42     标题: 批处理怎样根据用户输入来选择执行不同的命令?

比如说我要做个服务优化批处理,
您的计算机是否需要开启声音输出服务?
1.开启 2.关闭
set /p a=
后面怎么写呢?
作者: hfg1977    时间: 2010-10-2 00:28

  1. :start ============================================================
  2. echo 您的计算机是否需要开启声音输出服务?
  3. echo 1.开启 2.关闭
  4. set "choice="&set/p choice=输入你的选择(1/2/q):
  5. if /i "%choice%"=="q" goto end
  6. echo %choice%|findstr "^[12]$">nul 2>nul&&goto choice%choice%
  7. goto end
  8. :choice1
  9. sc config AudioSrv start= AUTO
  10. goto end
  11. :choice2
  12. sc config AudioSrv start= DISABLED
  13. :end ==============================================================
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2