Batch file running under Task Scheduler continues running after batch file completes

Viewed 67303

This is sort of a follow-up to my question earlier (link).

To test things out I made this simple batch file to ensure the Task Scheduler was properly executing the batch file:

cd "C:\Users\user\Desktop"
echo. 2>test.txt

So after the test.txt document is created on the desktop, the batch file should end but it continues to run:

Running Tasks List

Is there a way, either at the end of the batch file or a setting in the Task's Properties, to ensure that the cmd process quits?

Thanks!

7 Answers

Use following

exit /B

you may find more information in windows console area then type:exit/?

I know it's an old question, but I personally found that if I let a pause at the end of the bat file, it would keep the status as "Running".

I usually leave a pause at the end to help with debugging, but I found when I removed it, the task scheduler finally recognised it as having exited. It didn't help if I just refreshed it.

Related