Take the 2-minute tour ×

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

1 Answer 1

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
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

Your Answer


