Sachin
Sachin

Reputation: 1

Program to determine whether a Scheduled Task is running or not in .bat file?

I have 2 scheduled task say ABC and PQR,i want that if the scheduled task ABC is running then i want to stop it and run the scheduled Task PQR. if ABC is stopped then just run the PQR.

Upvotes: 0

Views: 177

Answers (1)

Stephan
Stephan

Reputation: 56238

to check if a task is running:

schtasks /query /TN ABC
if %errorlevel%==0 echo ABC is running 

to delete the scheduled task use

schtasks /delete /TN ABC

(maybe, you need an additional /F (Force))

to create a scheduled task you need some parameters. See schtasks /create /?.

If you have any more problems, please come back with the needed parameters and your "best try code"

Upvotes: 1

Related Questions