• Status: Solved
  • Priority: High
  • Security: Private
  • Views: 54
  • Last Modified:

How can set robocopy.bat to run as a scheduled task in Windows 7?

My secretary has two folders  "client billing" and "client letters" on her computer (running Windows 7 Pro).  The goal is to make a daily backup (using robocopy) of those folders to an external disk drive for my computer.

I have created a folder ("Client Data") on my external disk drive, and shared it with my secretary, so that a copy of the client folders can be stored there.

My secretary's computer has a mapped network drive, letter "J",  folder \\mypc\Client Data". (This references the external disk drive on my computer).

I have created a batch file "roboclients.bat" on my secretary's computer, which contains two commands:

Robocopy "c:\client billing" "j:\Client Data\client billing" /MIR /dcopy:T /E /zb /r:1 /w:1 /LOG:c:\Billing.txt

Robocopy "c:\client letters" "j:\Client Data\client letters" /MIR /dcopy:T /E /zb /r:1 /w:1 /LOG:c:\Letters.txt

On my secretary's computer, I manually run "roboclients.bat" from the command prompt and it copies the client "billing" and "letters" folders to the J: drive successfully.

I have tried to "automate" this process using Task Scheduler.  

roboclients.bat fails to run, because the error is:  cannot find destination folder.

If I can run roboclients.bat successfully manually, why can't it run as an automated task at a designated time?

Secondly, how can I have roboclient.bat run regardless of whether the secretary has the computer "locked", or "logged off".

Your help is greatly appreciated.
0
eemmpph
Asked:
eemmpph
  • 2
2 Solutions
 
NVITCommented:
The user running the task is shown under "When running the task, user the following user account". If that is wrong, change it using the Change User button.

> roboclients.bat fails to run, because the error is:  cannot find destination folder.
If j: is a mapped network drive letter, you'll need to map it somewhere in the batch file that runs

> Secondly, how can I have roboclient.bat run regardless of whether the secretary has the computer "locked", or "logged off".
Set the "Run whether user is logged on or not".
You may need to also set "Run with highest privileges"
0
 
David Johnson, CD, MVPOwnerCommented:
Robocopy "c:\client billing" "j:\Client Data\client billing" /MIR /dcopy:T /E /zb /r:1 /w:1 /LOG:c:\Billing.txt 
Robocopy "c:\client letters" "j:\Client Data\client letters" /MIR /dcopy:T /E /zb /r:1 /w:1 /LOG:c:\Letters.txt 

Open in new window

I would change J:\ to \\desinationcomputername\

and NOT run with highest privileges.
1
 
eemmpphAuthor Commented:
I changed the "current user"  account under which the batch file would run, to "Administrator" account..

I removed the letter "j:\" from the destination path, and changed it to \\computername\external hard drive folder.

Problem solved!

Thank you very much.
0
 
eemmpphAuthor Commented:
Oh, one more thing, I did NOT ENABLE run with highest privileges.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now