Running Batch files with Task Scheduler


G

Guest

Windows 2000 Adv Server sp4

I have a number of batch files I have created to do various tasks and have
scheduled them to run with my domain credentials at a scheduled time. When
Task Scheduler runs the item(s) I get a result of 0x4 so the tasks never
really run.

This is one example, I have a number of shares on computer A and I have
created a batch file which will xcopy the items from the share on folder A to
a mapped network drive (computer B) which has the same folder structure of
computer A. If I run the batch file outside of task scheduler it runs fine.
Text of the batch file is as follows:

echo on
xcopy D:\folder P:\folder /s/r/y

I would love these to run at the scheduled times and make my life a lot
easier.
What is happening here?
 
D

Dave Patrick

Scheduled Tasks|Advanced|View Log may provide some details. If the job
connects to another machine you may need to add the user/ group 'logon as
batch job' rights (server side). Control Panel|Admin Tools|Local Security
Policy\Local Policies\User Rights Assignments
"Log on as a batch job"

If the task completes but the job does not then there is a problem in the
job itself. Remember that if it involves network resources to make sure the
user account has permissions to the resources and also use UNC paths as
mapped drives won't natively exist when no one is logged on.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Windows 2000 Adv Server sp4
|
| I have a number of batch files I have created to do various tasks and have
| scheduled them to run with my domain credentials at a scheduled time. When
| Task Scheduler runs the item(s) I get a result of 0x4 so the tasks never
| really run.
|
| This is one example, I have a number of shares on computer A and I have
| created a batch file which will xcopy the items from the share on folder A
to
| a mapped network drive (computer B) which has the same folder structure of
| computer A. If I run the batch file outside of task scheduler it runs
fine.
| Text of the batch file is as follows:
|
| echo on
| xcopy D:\folder P:\folder /s/r/y
|
| I would love these to run at the scheduled times and make my life a lot
| easier.
| What is happening here?
 
Ad

Advertisements

G

Guest

Changing to UNC fixed it as all other settings are fine.

Follow up question, I was logged in at the time when the tasks were set to
run and the still didn't go so shouldn't the mapped drive letter still work
vs the UNC?
 
D

Dave Patrick

Only if you were logged on with the same account you used to run the task
with.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Changing to UNC fixed it as all other settings are fine.
|
| Follow up question, I was logged in at the time when the tasks were set to
| run and the still didn't go so shouldn't the mapped drive letter still
work
| vs the UNC?
 
D

Dave Patrick

What error was returned when you tried?

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I am logged on with the same ID that task scheduler is using.
 
Ad

Advertisements


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