Solved

Why doesn't this Scheduled backup task work?

Posted on 2004-09-09
7
136 Views
Last Modified: 2010-04-14
If i enter the following into COPY.CMD and then register this CMD into
the Schedule Task list I see it run & it exits immediately with error code 4.
Can anyone explain why?

File COPY.CMD
==========
echo "Delete target directories"
del /F /S /Q w:\*.*
echo "Copy Over"
xcopy f:\foo w:\foo /s /Y
xcopy f:\goo w:\goo /s /Y
xcopy f:\hoo w:\hoo /s /Y


The above was run under the Administrator account, F is the local machine, W is
a drive mounted on a separate machine on a local network.

Is it having a problem with the *.* list, there are quite a few files involved.
0
Comment
Question by:nicksbell
  • 4
  • 2
7 Comments
 
LVL 17

Expert Comment

by:Eagle6990
Comment Utility
What happens if you manually run the file from a command line? You might be able to see more of what is going on.
Are you trying to delete just the file or the directories as well? If you want to delete the directories then you need to use the rd command.
0
 
LVL 2

Author Comment

by:nicksbell
Comment Utility
Sorry, i should have mentioned that, i can run the CMD file just fine on its own, it is only
when run from the scheduler that it has the problem
0
 
LVL 17

Expert Comment

by:Eagle6990
Comment Utility
I would start rem'ing everything out, or maybe rem out everything and see if it can run then. if it can't, then you know it is an issue with your schedule.  Gradually work it back until you find out exactly which line is causing your error.
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 16

Expert Comment

by:glenn_1984
Comment Utility
The Task Scheduler needs a user name AND password to work.
You may add it to the Task Properties.

Then right click on the task and Run to test
0
 
LVL 2

Author Comment

by:nicksbell
Comment Utility

So, i investigated this some more. It seems to be related to the W drive. If i try and use the
same sort of CMD file to just delete (no xcopy) a file on the local C drive it works.

But if i try and delete the same file when it is on the shared W drive it fails!
0
 
LVL 17

Accepted Solution

by:
Eagle6990 earned 75 total points
Comment Utility
Sounds like a permissions issue.  Don't know for sure, but one thing you could try is to dismount the W: drive in your batch file and then remount it before attempting to delete so it is created with the same permissions the batch file has.  Try the "net use" command to remove and add a mapped drive.
0
 
LVL 17

Expert Comment

by:Eagle6990
Comment Utility
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now