Running BAT file in task scheduler WIN7 Pro
I have a bat file that uses xcopy to copy a directory on the local hard drive to a mapped drive (X:). The mapped drive is a share on a Windows Vista machine and when connecting it requires the user name and password of an account on the Vista Machine to connect. There is no server on the network, just two Vista ultimate and 2 win7 pro. If I run the bat file manually this works perfectly. When I create a scheduled task using Task Scheduler to do this it never runs. I have used cmd \c as part of the schedule but it simply does not start. When I look at the task history it tells me it has run though. I am unsure why this is happening? Could it be that that as the mapped drive requires a different user name and password to that of the local machine it is failing? The curious thing is the bat file works fine if I do it manually and the mapped drive is always present. Any ideas how I can get this task to schedule correctly?
March 29th, 2011 12:23pm

Hi, If this bat file works fine when you run it manually, it should be related to the settings about task schedule. Please check the following settings in Task Properties: In General tab, check Run with highest privileges. In Actions tab, click on the action and then the "edit" button at the bottom. In the "Edit Action" Window there is a field for "start in (optional)", please set the path for your bat file. Hope it helps. Alex ZhaoPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
March 31st, 2011 5:57am

Hi thanks for your reply! But I’m afraid this didn’t work. I did play around with the action settings and found if I set program/script to 'cmd' and add arguments to '/c C:\BatchFile.bat' the batch file runs on schedule ok. But if in the task properties under general I select to 'Run whether user is logged on or not' it only runs if the xcopy destination is on the local drive. If I set it to my mapped network drive (X:) or a network path it doesn’t even start - if I set up a log file I get no errors! When set to 'Run when user is logged on' it works perfectly regardless of where the destination folder is (local or network). I need to be able to schedule this task to copy files to a network location overnight regardless of where the user is logged on or not! So this works: xcopy "C:\DIR1\*" C:\DIR2\* /y /d /s /e /c /I /h /r /k But this doesn’t (X: is mapped network drive): xcopy "C:\DIR1\*" X:\DIR2\* /y /d /s /e /c /I /h /r /k or this: xcopy "C:\DIR1\*" \\OTHER-PC\DIR2\* /y /d /s /e /c /I /h /r /k Could this be because my network path (shared from a Vista Business machine) requires authentication user name and password which are different from the local machine? But I don’t understand why if this is the case the bat file didn’t start up then log an error?
April 1st, 2011 3:44am

i resolve dthis by using the ipaddress of the share location: xcopy "C:\DIR1\*" "\\192.168.0.1\ShareFolder\DIR2\*"
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2011 7:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics