Solved

Why doesn't this Scheduled backup task work?

Posted on 2004-09-09
7
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 17

Expert Comment

by:Eagle6990
ID: 12021977
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
ID: 12022642
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
ID: 12022733
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 16

Expert Comment

by:glenn_1984
ID: 12023240
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
ID: 12025989

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
ID: 12026857
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
ID: 12028534
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 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