Resolved question

Help with creating batch file to check scheduled task status

by bbcac - 12/12/11 1:01 PM

I want to create a batche file that will kick off a scheduled task on a remote server, check the status, then execute some more stuff

I can execute the scheduled task like this
schtasks /RUN /S myserver /TN "my_task_name"
I can check the status like this
schtasks /query /s myserver /fo list /tn "my_task_name" | find /c "Running"
When the query commands returns 0, I need it to execute some more commands afterwards.
Is there a way to put that query command in a loop so that it won't leave until it returns 0?