Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a task in Task Scheduler to run a batch file that resides on a local hard drive.

The batch file simply runs XCopy to copy files from a mapped drive to a folder on the local drive.

When the batch file is run from the command line, it functions perfectly.

When it's run from Task Scheduler, the XCopy command displays the error:

Invalid drive specification

If it matters, the drive is a NAS and is mapped to the computer using local credentials from the NAS (there is no active directory in the network).

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I've seen this behavior before when trying to backup to a mapped NAS. I don't know why, but it needs a "nudge" to remember that X: drive is mapped to \myserver\myfolder.

Manually, this can be solved by accessing the target folder. Once you "touch" X:, Windows "remembers" it's there. Programmatically (i.e. from batch), you can either try accessing the mapped folder, or maybe even remapping it (using the net command) in the batch, before the XCopy command.

share|improve this answer
1  
I tried several different ways of nudging. Finally issuing net use F: \\Server\Path (without re-supplying any credentials) did the trick. –  Eric J. Feb 9 '12 at 19:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.