Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I currently have three batch files and am trying to combine the functionality into one.

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"

So I execute run.bat to get what I want. That opens two command windows, with the respective commands run in each one and then they are minimized. How can I combine all this functionality into one bat script?

share|improve this question
add comment

1 Answer

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.