Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Task Scheduler Exit Code (4)

Status
Not open for further replies.

ChrisHallJJ

Programmer
Jul 25, 2003
27
US
I am getting a exit code of (4) from a task run from the Task Scheduler. Does anyone know what this code means?
And where can I find a list of these error messages?

The message that I am getting is:
backup.job (backup.bat)
Finished 8/24/2004 6:00:00 pm
Result: The task completed with an exit code of (4)
 
Tell us what us see in the log:

Scheduled Tasks>Advanced>View Log

X
 
The message I get in the log Scheduled Tasks>Advanced>View Log is as I stated in my question.

It is......

backup.job (backup.bat)
Finished 8/24/2004 6:00:00 pm
Result: The task completed with an exit code of (4)

I want to know what exit code (4) is.

Thanks,
Chris
 
The result is not of the task scheduler itself, it's the error level of the last command in the batch file that sets an error level. Can you post the contents of backup.bat?
 
The backup.bat file just contains a number of XCOPY commands....
e.g.
XCOPY "c:\Hh\*.*" "n:\Rebuild EDI PC\Hh\*.*" /E /y

So are you saying that the return code is from the XCOPY command?
Thanks, Chris
 
Does this work from the command line?
XCOPY "c:\Hh\*.*" "n:\Rebuild EDI PC\Hh\*.*" /E /y

You may want to try:
XCOPY /E /y "c:\Hh\*.*" "n:\Rebuild EDI PC\Hh\*.*"

Does the batch file run as expected when you run it normally?

X
 
As suggested by Xaqte if you run the command manually does it work ok?

One thing you might want to add is this switch /C as that will continue the copy even if an error occurs.

I'm not sure if your syntax is correct I just test copied something and I think you need to change your command to look like this.

xcopy "c:\Hh\*.*" "n:\Rebuild EDI PC\Hh\" /E /Y /C

Try this manually and see what happens.


Make the best use of what is in your power, and take the rest as it happens.
 
Normally this .bat file works just fine.... I only get the error occasionally. I just needed to know what exit code (4) was. Thank you for pointing me to look at XCOPY exit codes.

I believe that my problem is that I my system is running low on memory... the description for this error is on Microsoft's site.

Exit Code(4): "Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."

Also, the syntax of XCOPY as defined by Microsoft is
xcopy Source [Destination] [/switches]... [/switches]

Thanks, Chris
 
Yes that is correct but if you add the /C switch it will keep copying even if an error occur.

Also I don't see any need for having *.* at the end as this will not do anything you have already set it to copy everything (*.*) at the source so it will store that in the folder specified. Now granted it might work but I just thought that maybe it could have been the reason for your errors sometimes.

---
Make the best use of what is in your power, and take the rest as it happens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top