Task Scheduler

F

Frank

I am trying to find a list of the Windows completion codes
used in the Last Result column of Task Scheduler.

I found a short list at MS but it only has 0x0, 0x1 and
0xa. Specifically I wish to find out what 0x2 means.

Thanks.
 
P

Pegasus \(MVP\)

These codes are usually issued by the program you
invoke, not by the Task Scheduler itself.
 
F

Frank

On http://support.microsoft.com/default.aspx?scid=kb;en-
us;308558

it says

0x0: The operation completed successfully.
0x1: An incorrect function was called or an unknown
function was called.
0xa: The environment is incorrect.

which sounds like they're fixed. It also says

"The Last Result column displays a completion code. You
can obtain a full explanation of all Windows completion
codes from MSDN"

but I can't find it.
 
P

Pegasus \(MVP\)

Try the following. You must type everything verbatim -
don't take any liberties unless you know what you're
doing.

- Start a Command Prompt
- Type the following:
debug c:\Task.com {Enter}
a {Enter}
mov ax,4c07 {Enter}
int 21 {Enter}
{Enter}
rcx {Enter}
5 {Enter}
w {Enter}
q {Enter}
You have now created a simple program that does nothing
at all, other than returning a termination code of 7.
- Type these commands:
c:\Task.com
echo %ErrorLevel%
You will see the number 7 on the screen. This is what Task.com
returns.
- Schedule c:\Task with the Task Scheduler, then run it.
You will see a Last Result code of 7.

QED.
 
F

Frank

Indeed if you're going to arbitrarily choose the code.
There are usually guidelines about this sort of thing
though and the error code was returned by XCOPY running in
a Command Prompt window. I'll find the answer somewhere.
 
P

Pegasus \(MVP\)

I did not chose the code arbitrarily. Common convention
is that a return code of 0 means that the program worked
as expected. A return code > 0 means that there was some
error.

Example: An attempt to xcopy a file without having
the appropriate permission will return an ErrorLevel of 4.
When you try to use the "copy" command then you
get an ErrorLevel of 1.

Arbitrary? Maybe. Inbuilt into the command? Yes!

I now recommend that you do some of your own tests.
The xcopy test is quite straightforward.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top