Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Scheduled task succeeds but returns result 0x1

I have a scheduled task on a Windows 2008 R2 server. The task includes a Start In directory entry. The task runs, and the batch file it runs does what it is supposed to do. When I run the batch file from a command prompt, I see no errors. The problem is that the "Last run result" is 0x1 (incorrect function call).

I did get this at one time with an incorrect DOS statement IF EXISTS file.txt DO (Copy file.txt file1.txt) that was corrected by dropping the DO statement. The current batch file does not show me any errors or warnings.

Why am I getting a 0x1 result?

Batch file that is run:

PUSHD \\JUKEBOX4\Archives\CallRecording
REM only move csv and wma together.  wma should be created last.
IF NOT EXIST C:\CallRecording (MKDIR C:\CallRecording)
FOR /f %%f IN ('DIR /b *.wma') DO (
    IF EXIST %%~nf.csv (MOVE /Y %%~nf.* C:\CallRecording\)
)
POPD
CD /D "C:\Program Files (x86)\Olim, LLC\Collybus DR Upload"
CollybusUpload.exe
POPD

Info on scheduled task setup:

  • Program to run: C:\Program Files (x86)\Olim, LLC\Collybus DR Upload\CallRecordingUploadFromH.cmd
  • Start in: C:\Program Files (x86)\Olim, LLC\Collybus DR Upload
  • Run whether user is logged on or not, highest privileges.

History screen, task completed entry

"Task Scheduler successfully completed task "\Call recording upload to portal from NH" , instance "{1449ad42-2210-427a-bd69-2c15e35340e6}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 1."

First screen of Task Scheduler shows "Run Result" of "Success"

like image 559
user241099 Avatar asked Aug 22 '13 02:08

user241099


People also ask

How do I fix 0x1 error in Task Scheduler?

"Run with highest privileges" (test both options) "Run wheter user is logged on or not" (test both options) Check that "Configure for" is set to your machine's OS version. Make sure the user account running the program has the right permissions.

What is 0x41301 in Task Scheduler?

In "Last run result" field of Task Scheduler I get a strange error 0x41301. I googled it and discovered that it means "Task is already running". Surprisingly I found this program in running tasks just after system boot but no GUI is shown. Only the process itself is running.

What does 0x2 mean in Task Scheduler?

According to the command line command, "net helpmsg 2", "0x2" equates to "The system cannot find the file specified."


3 Answers

It seems many users are having issues with this. Here are some fixes:

  • Right click on your task > "Properties" > "Actions" > "Edit" | Put ONLY the file name under 'Program/Script', no quotes and ONLY the directory under 'Start in' as described, again no quotes.

  • Right click on your task > "Properties" > "General" | Test with any/all of the following:

    1. "Run with highest privileges" (test both options)
    2. "Run wheter user is logged on or not" (test both options)
    3. Check that "Configure for" is set to your machine's OS version
    4. Make sure the user account running the program has the right permissions
like image 165
full_prog_full Avatar answered Oct 16 '22 17:10

full_prog_full


I found that I have ticked "Run whether user is logged on or not" and it returns a silent failure.

When I changed tick "Run only when user is logged on" instead it works for me.

like image 25
lsheng Avatar answered Oct 16 '22 17:10

lsheng


I've had the same problem. It is just a batch-file, working when manually started, but not working as a scheduled task.

there were drive-letters in the batch-file like this:

put z:\folder\file.ext

seems like you should not use drive-letters, they are bound to the user, who created them - for me this little change made it work again:

put \\server\folder\file.ext
like image 5
roeb Avatar answered Oct 16 '22 17:10

roeb