none
Robocopy fails as scheduled task in Windows 7 with error code 0x10 RRS feed

  • Question

  • Hi,

    I'm trying to migrate a robocopy based backup from XP (where it does work) to Windows 7.  The backup job simply copies a directory on the local PC to a network drive on the file server using a batch file which contains the following:

    robocopy "C:\projects" "N:\backup" /e /s /r:1 /w:1 /log+:backuplog.txt

    The user account it is running under has full access to the network drive (N:).  When I run the batch file directly from the command line it works perfectly.  It also used to work without issue on a Windows XP machine.  UAC is disabled.

    Whenever the task runs it fails with the error code 0x10.

    Thanks

    Tuesday, September 27, 2011 1:17 PM

Answers

  •  

    0x10=ERROR_BAD_ENVIRONMENT
    10 (0xA) The environment is incorrect.
     

    I would reciommend using UNC paths (\\server\share\folder\) instead of mapped drives and specifying full paths in quotes whenever possible (not backuplog.txt, but "c:\logs\backuplog.txt"


    MCP/MCSA/MCTS/MCITP
    Tuesday, September 27, 2011 1:53 PM
  • Here's a similar thread that had problems running a batch file using Task Scheduler. A respondent Brian Vandemark proposed the following solution which helped many people fix the issue. This post got many helpful votes, so I guess this is the solution and should work:

    http://social.technet.microsoft.com/Forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe

    Quoting from there for your convenience, it says:

    "I wanted to summarize all of the steps I performed to solve my problem.  I would guess that maybe some of these are not needed, but I'll list them all to hopefully help you get it working

    1) Make sure that the task is set to "configure for Windows Vista or Windows 2008" on the first page of the task properties (under the "general" tab)
    2) Make sure that the task is set to "start in" the folder that contains the batch file: open the task properties, click on the "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)" that you set to the path to the batch file.
    3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things:  The .bat file itself,  the folder containing the .bat file, and the target files/folders that are affected by the .bat script.  Inherited permissions didn't seem to work for me.
    4) Make sure that the account running the task is a member of the local "administrators" group for this machine
    5) Make sure that the task is set to "run whether logged on or not"
    6) The Task should run successfully with expected output when you right-click on the task and select "run"  If it does that then it will run successfully when you are logged off.

    Good Luck!"

     

    Please revert back here if this does not resolve your issue. Hope it helps!


    Kunal D Mehta - a Windows Server Enthusiast | I'm on facebook.com/serverbaba
    Wednesday, September 28, 2011 6:56 PM

All replies

  •  

    0x10=ERROR_BAD_ENVIRONMENT
    10 (0xA) The environment is incorrect.
     

    I would reciommend using UNC paths (\\server\share\folder\) instead of mapped drives and specifying full paths in quotes whenever possible (not backuplog.txt, but "c:\logs\backuplog.txt"


    MCP/MCSA/MCTS/MCITP
    Tuesday, September 27, 2011 1:53 PM
  • Here's a similar thread that had problems running a batch file using Task Scheduler. A respondent Brian Vandemark proposed the following solution which helped many people fix the issue. This post got many helpful votes, so I guess this is the solution and should work:

    http://social.technet.microsoft.com/Forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe

    Quoting from there for your convenience, it says:

    "I wanted to summarize all of the steps I performed to solve my problem.  I would guess that maybe some of these are not needed, but I'll list them all to hopefully help you get it working

    1) Make sure that the task is set to "configure for Windows Vista or Windows 2008" on the first page of the task properties (under the "general" tab)
    2) Make sure that the task is set to "start in" the folder that contains the batch file: open the task properties, click on the "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)" that you set to the path to the batch file.
    3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things:  The .bat file itself,  the folder containing the .bat file, and the target files/folders that are affected by the .bat script.  Inherited permissions didn't seem to work for me.
    4) Make sure that the account running the task is a member of the local "administrators" group for this machine
    5) Make sure that the task is set to "run whether logged on or not"
    6) The Task should run successfully with expected output when you right-click on the task and select "run"  If it does that then it will run successfully when you are logged off.

    Good Luck!"

     

    Please revert back here if this does not resolve your issue. Hope it helps!


    Kunal D Mehta - a Windows Server Enthusiast | I'm on facebook.com/serverbaba
    Wednesday, September 28, 2011 6:56 PM
  • I had the same issue and have to configure these two settings.

    • Proposed as answer by Fuat Goztepe Wednesday, January 7, 2015 5:59 PM
    Wednesday, September 19, 2012 11:08 PM
  • Thanks! I just needed to check this and my job kicked-off without a hitch.
    Tuesday, March 24, 2015 2:52 PM
  • I had the same issues. Tried to let

    ROBOCOPY "[UNC-PATH]" "C:\Profiles" /MIR /R:3 /W:3 > C:\profilecopy.log

    run. But always 0x10 :/

    I did all the things mentioned above - no help!

    It finally worked when I saved this command as a batch file and let this batch file run, instead of pasting the written above command under "Actions" (I think the tab is called that way in English).

    Monday, July 11, 2016 2:47 PM
  • None of these fixed it, but putting the Run in folder in quotes (even though it had no spaces) fixed it for me. 
    Friday, June 29, 2018 1:05 PM