| Trusted Advisor with 19,465 posts. | | Join Date: Apr 2003 Location: 1265 Lombardi Ave | |
What you would want to do at the top of your batch file is use the TASKLIST program to find cmd.exe with the window title of your batch file. IF it finds it then exit your batch file.
Then after that set the Title of your batch file
So do something like this at the top of your batch file Code: for /F "tokens=1" %%G in ('tasklist /V /NH /FO TABLE /FI "WINDOWTITLE eq BATCH1"') do IF %%G==cmd.exe exit /b
TITLE BATCH1 First time it runs it will not find BATCH1
Second time it runs it should exit the batch file. |