Task scheduler 0x1 error is a common error appearing when you scheduling mainly batches or scripts. From the error return code, you cannot understand where is the issue. Common the issue is related to the script or batch finish with any error or fails to find something it’s looking for and can’t pass to the task scheduler successfully status. To find the issue you will need to troubleshoot some solutions. We will try to present and explain some of the common solutions about return code 0x1.
Error message and view:
“Task Scheduler successfully completed task “\test” , instance “{xxxxx}” , action “C:\Windows\SYSTEM32\cmd.exe” with return code 1.”
How to Fix Task scheduler 0x1
Fix task scheduler last run result 0x1:
- Try to create the task using the “Create Task” option instead of the “Create Basic Task”
- Use UNC paths in your batch files
- Try to use UNC paths in the “Actions” Tab
- Put the path into the ‘Start In’ box
- Quote the paths if there are spaces like “C:\Test 1\”
- Explicitly state all paths used in the scripts files
- Try to close or “exit” the script in the end.
- Run manually the script or batch to check if any error appears.
- “Run with highest privileges” (test both options)
- Try “Run whether the user is logged on or not” (test both options)
Fix return code 0x1 with long solution
1. Solutions about “Action Tab”
- UNC paths
If you are trying to run the script or batch in map drive instead of specifying the latter try to use the full UNC path. For example:
Instead of M:\test\ use \\(IP or servername)\test\
- Configure the paths
Try to configure the path on ‘Start In’ box like below:
- Quote the paths
Especially on scripts and batches windows has the problem to understand paths with spaces if they are not quoted. Try to use quotes on paths with spaces on task schedule configuration or on scripts and batches.
2. State all paths
Try to explicitly state all paths used in the scripts or batches files. Don’t use short path
e.g. the code in Test.bat
call test.bat > test.log
Became
call “D:\Test Path\test.cmd”> “D:\Test Path\test.log”
3. Exit on scripts
Sometimes the scripts stay running and can’t pass the finishing status to the task scheduler. To avoid this try to state exit or close command on the end of the scripts or batches.
4. Check the scripts for error
Even if the script or batch runs correctly sometimes return error code. To troubleshoot this you can run the script or batches manually using a pause statement at the end of it.
To get the error code to add one more line on the end of the script or batch as below:
echo ErrorCode = %ErrorLevel%
To fix this you can add another command in the end in order to return an error status code 0. For example, add one line to write the current time.
5. Specify “stop task”.
In cases where the task stays running, you can configure the Task schedule to stop. To do this:
- Open Task Scheduler and navigate to settings
- Check “Stop the task if it runs longer than
- Specify after how much time will stop
So the next day the scheduler will be ready to start.
Conclusions error code 0x1:
Above we included almost all solutions and troubleshooting regarding the task scheduler 0x1 error code. Error 0x1 his hard to debug and need to try a couple of solutions in order to find the reason for your environment.