0

I wanted to run two programs using a single batch file in python.

The code below does this, but I want that, when the first program has finished executing the second program will stop running and the batch file will close.

@ECHO off
start C:\Users\User1\Desktop\Softwares\Googletalk
start C:\Users\User1\Desktop\Softwares\YahooMessenger
2
  • 1
    Do you have any logic you are currently using for this task to edit and add to your question? Commented Jun 11, 2017 at 4:57
  • I'm not sure this can be done in batch without some third-party utilities that may or may not exist. I'm fairly certain it can be done in Powershell, however - would such a solution be acceptable? Commented Jun 11, 2017 at 22:09

1 Answer 1

1
@echo off
setlocal
start "my_yahoo" /D "C:\Users\User1\Desktop\Softwares\" "YahooMessenger"
start /WAIT "my_gtalk" /D "C:\Users\User1\Desktop\Softwares\" "Googletalk"
for /f "tokens=2 delims=," %%i in ('tasklist /nh /fo csv /fi "WINDOWTITLE eq my_yahoo"') do taskkill /PID %%i /F >NUL 2>&1
endlocal
exit/B
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.