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:
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!
Here, RUNNING means the task is running not the executable. This actually should not cause problem if you have the option "If the running task does not end when requested, force it to stop" enabled in Settings tab. In Settings tab, you can also enable the option "Stop the task if it runs longer than" to stop this task.
Step 1: Create a batch file you wish to run and place it under a folder where you have enough permissions, for example, under C drive. Step 2: Click on Start and under search, type in Task, and click open Task Scheduler. Step 3: Select Create Basic Task from the Action pane on the right of the window.
I ran into the exact same problem. However, I felt duped when I read what Trevor778 wrote in this post:
I had the same problem - the task worked but the status kept showing Running. One simple thing to try is click on the Task Scheduler Library in the left column. Click Action/Refresh. Presto. Status changed to Ready. That's all it was for me, the task ran fine, just the status didn't update. Hope this helps.
ref: https://social.technet.microsoft.com/Forums/en-US/2f6dc29c-3b8b-45f5-a2a7-53e076acc062/task-scheduler-scheduler-status-is-being-running-always?forum=winservergen
you can add "exit" to last line of your script
cd "C:\Users\user\Desktop" echo. 2>test.txt exit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With