Using Task Scheduler fails to run RoboCopy.

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #11

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


  2. Posts : 207
    Windows 7 Professional 64bit
    Thread Starter
       #12

    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 Computer


  3. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #13

    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 Computer


  4. Posts : 207
    Windows 7 Professional 64bit
    Thread Starter
       #14

    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 Attached Thumbnails Using Task Scheduler fails to run RoboCopy.-screenshot-050114.png  
      My Computer


  5. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #15

    It's no problem Alan :) I'll have more of a look for you tonight.
      My Computer


  6. Posts : 207
    Windows 7 Professional 64bit
    Thread Starter
       #16

    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 Computer


  7. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #17

    Yep. Remove the pause.
      My Computer


  8. Posts : 207
    Windows 7 Professional 64bit
    Thread Starter
       #18

    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 Computer


  9. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #19

    The log should reside in the same location as the .bat file.....presumably your desktop? Do a search for it in Windows Explorer.
      My Computer


  10. Posts : 207
    Windows 7 Professional 64bit
    Thread Starter
       #20

    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 Computer


 
Page 2 of 3 FirstFirst 123 LastLast

  Related Discussions
Our Sites
Site Links
About 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 10:29.
Find Us