Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Using Task Scheduler fails to run RoboCopy.

04 Jan 2014   #11
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

No problem Alan. If you need to put more items into the bat file too, just let me know.


My System SpecsSystem Spec
.
04 Jan 2014   #12
Trapper

Windows 7 Professional 64bit
 
 

Firstly.



Apologies. After posting that Synctoy did not list as folders and sub-folder I realised I was looking at the preview in Synctoy and had not run the program, hence the long list of individual files. I then tried again on my music folder and it worked fine with all sub-folders copied along with their 6000 files! I felt a right idiot but I guess we all get it wrong sometimes...

If there is a way to use Robocopy with Task Scheduler then that would be great, as I can then use both to backup to seperate drives.

Golden. The files I am copying at present are these;

robocopy "I:\DATA" "M:\DATA" /e /np /tee /mt:4 /log:my_backup_log.txt
robocopy "C:\Program Files (x86)\Microsoft Money 2005" "M:\Money File Backups" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Users\Alan\Documents\Outlook Files" "M:\Outlook Files - NEW 21 03 2012" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Users\Alan\AppData\Roaming\Mozilla\Firefox\Profiles\00nrkh7f.default" "M:\Mozilla File Backups" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Program Files\Microsoft Office\Office14\Queries" "M:\Queries Alans Address Book 02.xls" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Program Files (x86)\Steam\SteamApps\common\Half-Life 2" "M:\Half-Life 2" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Users\Alan\Documents\My Phone Calls" "M:Users\Alan\Documents\My Phone Calls" /e /np /tee /mt:4 /log+:my_backup_log.txt
robocopy "C:\Program Files (x86)\Steam\userdata\12161089" "M:Program Files (x86)\Steam\userdata\12161089" /e /np /tee /mt:4 /log+:my_backup_log.txt
pause

Regards
Alan.
My System SpecsSystem Spec
05 Jan 2014   #13
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

Alan - I have a much simplier alternative. Since you use Windows 7 Professional, you have access to Group Policy - its far easier to run a script at ShutDown using this.

Do a test using that small .bat file we put together earlier.

Steps:
1. Click the Windows logo and the R key on the keyboard to open the Run Dialogue box
2. In the box, type gpedit.msc as shown below, and click OK

Using Task Scheduler fails to run RoboCopy.-2.png

3. The Group Policy panel will open. Browse to the Scripts section, and then double-click the ShutDown option as shown below

Using Task Scheduler fails to run RoboCopy.-3.png

4. In the ShutDown Properties panel that opens, click the Add button

Using Task Scheduler fails to run RoboCopy.-4.png

5. Click Browse to browse to and select the .BAT file you created, and click OK.

Using Task Scheduler fails to run RoboCopy.-5.png

6. Now Close the Group Policy panel - click File then Exit to close it.

Now to test - shut down the computer as normal. It should run the robocopy .bat file, and then shut down. Let us know how it goes.


My System SpecsSystem Spec
.

05 Jan 2014   #14
Trapper

Windows 7 Professional 64bit
 
 

Thank you for you help, things did not go to plan, I have tried this 3 times and each time the 'Shutting Down screen appears with the cursor for about 4 minutes each shutdown, at that point I hit the reset button to reboot the PC.
As you can see from the screenshot below I have the test.bat file on the desktop and it's set to run as administrator, the shutdown properties box shows C:\Users\Alan\Desktop\test.bat which seems fine. When I click on 'Show Files' the screen you see below appears; 'backup_log.txt' So something does not seem to be right somewhere

I do not want to cause you any more problems and think it may be less problematical to put a post-it reminder on my monitor!

Regards
Alan.


Attached Thumbnails
Using Task Scheduler fails to run RoboCopy.-screenshot-050114.png  
My System SpecsSystem Spec
06 Jan 2014   #15
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

It's no problem Alan I'll have more of a look for you tonight.
My System SpecsSystem Spec
07 Jan 2014   #16
Trapper

Windows 7 Professional 64bit
 
 

Need to go out but just thought of something, in the test.bat script it ends at 'pause' maybe the shutdown will not shutdown as the script is 'paused' and not finished?

I will try it tomorrow and see if it works without the pause.
My System SpecsSystem Spec
07 Jan 2014   #17
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

Yep. Remove the pause.
My System SpecsSystem Spec
08 Jan 2014   #18
Trapper

Windows 7 Professional 64bit
 
 

Hi Golden.
Removing the 'pause' cured the problem

Where can I find the 'Log' as it does not appear on the desktop on rebooting? It does appear if I run the file without shutting down.

Once again thank you for your help.

Regards
Alan.
My System SpecsSystem Spec
08 Jan 2014   #19
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

The log should reside in the same location as the .bat file.....presumably your desktop? Do a search for it in Windows Explorer.
My System SpecsSystem Spec
09 Jan 2014   #20
Trapper

Windows 7 Professional 64bit
 
 

Thank you.
The backup_log, when run from the shutdown script resides at C:\Windows\System 32\Group Policy\Machine\Scripts\Shutdown
When run from the desktop the Backup_log is on the desktop, if I need to see copy I can now find it either way.

I have found a Robocopy switch list, well I think that's what you'd call it. I lists all the /e /s /sec commands,

I have removed the /mir from your script above and now have:
robocopy I:\DATA M:\Backup_DATA /e /np /log:backup_log.txt

as I want any files deleted on my I: drive not to be deleted on my M: drive in case I find I need it later.
In my previous robocopy scripts I have /mt:4, this, in my list shows as Multithreaded copying. What does this mean? The number of lines of scripts? Or something else?

Can I add files to the script I now have;
robocopy I:\DATA M:\Backup_DATA /e /np /log:backup_log.txt

and add my own files to theM:Backup_DATA folder? and would I need to add the /mt [:n] for the number of lines added below - /mt:3?
robocopy C:\system32 M:\Backup_DATA /e /np /log:backup_log.txt
robocopy D:\Gardening M:\Backup_DATA /e /np /log:backup_log.txt

Sorry if these are silly questions, Guessing is fine if it works but a disaster if it goes wrong!

Regards
Alan.
My System SpecsSystem Spec
Reply

 Using Task Scheduler fails to run RoboCopy.




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Task Scheduler - Create Task to Display a Message Reminder
How to Display a Message Reminder in Windows with Task Scheduler This will show you how to create yourself, or another user or group, a message reminder scheduled to display for when and how often you like in Windows 7 or Vista using Task Scheduler. All users on the computer will be able to...
Tutorials
robocopy script is not working through Scheduler
Dear All, My batch file of robocopy is working fine. But when I tried to run it through task scheduler, none of the files transfer to the target location. @echo off echo +-----------------------------------------+ echo Database Export Utility for server ...
General Discussion
Task Scheduler Fails when Running VB Compile EXE
Hi Everyone, I am puzzled. I created an exe with Visual Studio 2010 to automate the execution of a 2nd program. This exe requires 2 command line arguments. When I run this exe from a Short cut with the arguments defined everything works as desired.
General Discussion
Need help creating a task scheduler task to move files over a network.
Hello everyone, I need to have a task run that will move the contents of a folder from one computer to another over my home LAN. Files get downloaded during the night on one computer and then need to be transfered to another. Usually I am doing this by hand, but then though maybe I could get...
General Discussion
Task scheduler unable to load task status/active tasks at startup.
My task manager is unable to load task status/active tasks at startup. I get the message: "The selected task "{0}" no longer exists. To see the current tasks, click Refresh." When I refresh I get the same message. I checked and found that under Microsoft the problem was in the defrag...
Performance & Maintenance
Task Scheduler failing to start task with merged network locations
I have two routers I usually connect to (work and home) and each have wireless access. That means there are essentially 4 network locations I have listed. I have merged each respective network location (wired and wireless) into their own singular network location - "Work" and "Home". I also...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 13:05.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App