Dragon
Dragon

Reputation: 1284

running two exe files with a single batch file in python

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

Upvotes: 0

Views: 998

Answers (1)

elzooilogico
elzooilogico

Reputation: 1705

@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

Upvotes: 1

Related Questions