Simple sequential execution scheduling windows script

S

Windows CMD (Command Line) supports an easy way to automate some task. This can be archived by creating *.bat files and edit them using a simple text editor. The syntax is something that can be found easily by searching.

Below is a simple script which can be used to schedule the execution of applications in a sequential way. It means that the .bat script will wait for the X application to finish before it executes the X+1 application.

@echo off

echo Starting Executable 1
notepad.exe
tasklist /FI "IMAGENAME eq notepad.exe" 2>NUL | find /I /N "notepad.exe">NUL
:label1
if "%ERRORLEVEL%"=="0" goto label1

echo Starting Executable 2
notepad.exe
tasklist /FI "IMAGENAME eq notepad.exe" 2>NUL | find /I /N "notepad.exe">NUL
:label2
if "%ERRORLEVEL%"=="0" goto label2

echo End
pause

 

 

 

 

Disclaimer: The present content may not be used for training artificial intelligence or machine learning algorithms. All other uses, including search, entertainment, and commercial use, are permitted.

Categories

Tags