Return Code (0x1) is the most common error when you try to run a scheduled task. It’s so common that I have faced this error many times. Mostly this error comes because of not providing enough privilege. This means the user which you’ve chosen to execute that task doesn’t have enough privilege at the path specified or is unable to locate the task file for some reason. Here are a few ways to fix this issue:
Fix Task Scheduler Returns Code (0x1) Error in Windows 7, 8 & 10
Solution 1: Via Defining Start in
Path
I have found that entering the directory path to the “Start in (optional):” block for where the script originates works always. If you put in the quotations around the directory, even though there is a space, within the Start inbox I find it doesn’t work, so you see I didn’t put them in.
Check out this video on how to do it:
Solution 2: Running Task with Highest Privileges
Always check the “Run with highest privileges” option while creating the task. Also, remember that the user account you are using for the task has the privileges necessary for the programs in the batch file to complete successfully; i.e. if a command to copy something to a server is running with a user account that exists on the local machine, but not on the server you are copying to, the task will fail silently and may or may not report a result. The same will happen if the username on the local machine and the server is the same, but the password is not.
Solution 3: Defile full Relative path
Check your relative paths in the batch file. If you are using drive letters that points to a network drive. (drive that the is assigned to the user when logged on) then you won’t be able to run the task with “Run whether user is logged in or not“.
To use “Run whether user is logged in or not” you need to use UNC paths or point to the physical disk (if local drive).
For example, if the code in runTest.bat is:
call test.bat > test.log
which eventually should be changed to:
call "C:\test.bat" > "C:\test.log"
Depending on the program executed in the batch file, it is however not always possible to use UNC paths
.
Solution 4: Use “Create Task” Not “Create Basic Task” for Creating Tasks
There are three important options to make sure your task will run:
- Create your task using the “Create Task” option instead of the “Create Basic Task” (this gives you more options for the server type, usually the default server will work –
Windows Server 2003, Windows XP, or Windows 2000
). - Use only
UNC paths
in your batch files and in the “Actions” Tab. You can map drives on your computer, but you must use the UNC paths throughout your task. - On the “General” tab, select the “Change User or Group” and add the correct credentials even if you are already signed into the account with the correct credentials.
These options should work if you select to run the task when the user is logged on or not. Place a pause at the end of your batch file so you can see any errors and test run the job.
Solution 5: For Powershell Script, Create it the Right Way
Action: Start a Program Program/Script: PowerShell.exe Argument: -File "<<local path to PowerShell script including script name>>" Start In: <<blank>>