我目前有三个批处理文件,并试图将功能合并为一个。
run.bat
--------
start "" /min cmd /k first.bat
start "" /min cmd /k second.bat
first.bat
--------
call C:\Users\jh\python_environment\Scripts\activate.bat
coilmq
second.bat
--------
call C:\Users\jh\python_environment\Scripts\activate.bat
python "C:\Users\jh\run\main.py"
因此我执行 run.bat 来获得我想要的东西。这会打开两个命令窗口,每个窗口运行相应的命令,然后它们被最小化。我如何将所有此功能合并到一个 bat 脚本中?
答案1
run.bat
if not "%~1"=="" goto %1
start "" /min cmd /k "%~0" first
start "" /min cmd /k "%~0" second
goto :EOF
:first
call C:\Users\jh\python_environment\Scripts\activate.bat
coilmq
goto :EOF
:second
call C:\Users\jh\python_environment\Scripts\activate.bat
python "C:\Users\jh\run\main.py"
goto :EOF