Batch file 批处理命令输入菜单
我有个问题。是否可以使批处理菜单同时接受多个命令 示例:(我的代码) 如何使程序接受多个命令? 例如,1、3、5要同时执行吗Batch file 批处理命令输入菜单,batch-file,batch-processing,Batch File,Batch Processing,我有个问题。是否可以使批处理菜单同时接受多个命令 示例:(我的代码) 如何使程序接受多个命令? 例如,1、3、5要同时执行吗 或者另一个问题,如何将.exe还原回.bat? 有这样一个程序吗?建议:从转到调用,并将命令与和连接起来: IF /I '%INPUT%'=='1' GOTO:Selection1 IF /I '%INPUT%'=='2' CALL:Selection2&CALL:Selection2&CALL:Selection4 IF /I '%INPUT%'=='3' CALL:S
或者另一个问题,如何将.exe还原回.bat?
有这样一个程序吗?建议:从
转到调用,并将命令与和连接起来:
IF /I '%INPUT%'=='1' GOTO:Selection1
IF /I '%INPUT%'=='2' CALL:Selection2&CALL:Selection2&CALL:Selection4
IF /I '%INPUT%'=='3' CALL:Selection3&CALL:Selection3
IF /I '%INPUT%'=='4' CALL:Selection4&CALL:Selection4
IF /I '%INPUT%'=='5' CALL:Selection5
IF /I '%INPUT%'=='6' CALL:Selection6
IF /I '%INPUT%'=='7' CALL:Selection7
IF /I '%INPUT%'=='8' CALL:Selection8
IF /I '%INPUT%'=='9' CALL:Selection9
IF /I '%INPUT%'=='Q' GOTO:Quit
goto:eof
将控制权返回主程序。您可以使用start”命令
关键字,每个命令将在自己的窗口中运行,但由菜单批处理文件启动。这就是您要查找的吗
文件菜单.cmd
@echo off
setlocal
set quit=false
set /p InputChoices=Enter Choice(s) (A,B,C)
echo %InputChoices%
call :executeChoices %InputChoices%
endlocal
goto :eof
:executeChoices
if [%1]==[] goto :eof
call :Step%1
shift
goto :executeChoices
goto :eof
:StepA
echo Step A
goto :eof
:StepB
echo Step B
goto :eof
:StepC
echo Step C
goto :eof
工作原理如下:
c:\>Menu.cmd
Enter Choice(s) (A,B,C) b c a
b c a
Step B
Step C
Step A
另一个问题是,如何将.exe还原回.bat?有这样的节目吗?
@echo off
setlocal
set quit=false
set /p InputChoices=Enter Choice(s) (A,B,C)
echo %InputChoices%
call :executeChoices %InputChoices%
endlocal
goto :eof
:executeChoices
if [%1]==[] goto :eof
call :Step%1
shift
goto :executeChoices
goto :eof
:StepA
echo Step A
goto :eof
:StepB
echo Step B
goto :eof
:StepC
echo Step C
goto :eof
c:\>Menu.cmd
Enter Choice(s) (A,B,C) b c a
b c a
Step B
Step C
Step A