Task Scheduler return 0x1 code

N

Newbie

Hi,

I'm trying to schedule a batch file just to ping our firewall to make sure
it's alive. The batch file has one line:

ping 192.168.2.1

I can double-click on the batch file and it executes fine. When I set up a
new scheduled task, I'm getting an error code of 0x1. It doesn't seem to
run. The scheduler log shows:

"dns.job" (dns.bat)
Finished 6/7/2006 3:54:00 PM
Result: The task completed with an exit code of (1).

Is there something wrong in the batch file?

Appreciate your help.
 
P

Pegasus \(MVP\)

Newbie said:
Hi,

I'm trying to schedule a batch file just to ping our firewall to make sure
it's alive. The batch file has one line:

ping 192.168.2.1

I can double-click on the batch file and it executes fine. When I set up a
new scheduled task, I'm getting an error code of 0x1. It doesn't seem to
run. The scheduler log shows:

"dns.job" (dns.bat)
Finished 6/7/2006 3:54:00 PM
Result: The task completed with an exit code of (1).

Is there something wrong in the batch file?

Appreciate your help.

The return code is generated by what you run inside your
batch file, not by the Task Scheduler itself. Modify your
batch file like so to see what's going on, then examine the
log file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
ping SomeServer 1>>c:\test.log 2>>&1
echo ErrorLevel ping.exe=%ErrorLevel% >> c:\test.log
echo %date% %time% End of task >> c:\test.log
 
N

Newbie

Thank you for your help. The log file shows the ping results and everything
seems to be fine.

Does this 0x1 code mean there's a problem?

Thanks again.
 
N

Newbie

Hi,

Here's the contents of the test.log file:

---------------------------
Fri 06/09/2006 11:19:00.23 Start of task
User=scheduler,
Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program
Files\Symantec\pcAnywhere\

Pinging 192.168.2.1 with 32 bytes of data:

Reply from 192.168.2.1: bytes=32 time=328ms TTL=253
Request timed out.
Reply from 192.168.2.1: bytes=32 time=328ms TTL=253
Reply from 192.168.2.1: bytes=32 time=329ms TTL=253

Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 328ms, Maximum = 329ms, Average = 246ms
ErrorLevel ping.exe=0
Fri 06/09/2006 11:19:04.04 End of task
 
P

Pegasus \(MVP\)

I cannot see how my batch file would cause the Task Scheduler
to generate a return code other than 0, unless you added
further lines to my code without telling us. On the other hand
the log file proves conclusively that the batch file DID run,
even though your original post said the opposite.
 
N

Newbie

Hi,

I just copied your batch file and modified "SomeServer" to the IP address of
the server I want to ping. It wasn't running but it's now. It's confirmed
in the firewall log.
 

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