Windows 10: Robocopy syntax doesn't work in my batch file anymore Solved

Page 2 of 4 FirstFirst 1234 LastLast
  1.    3 Weeks Ago #11

    What are you trying to do with the /MT switch? This is to define the number of threads your copy command uses and you have picked 25. The default is 4. Unless you have multiple CPU it is probably best to leave it out - there is also a issue since 4000BC where using the /MT switch messes up your log file.

    The second error you got is because you forgot to run as administrator.

    Open a command prompt as you or administrator any type in "WhoAmI /all" and you will see exactly the difference.
      My ComputerSystem Spec


  2. Posts : 78
    windows 10 professional 64-bit
    Thread Starter
       3 Weeks Ago #12

    Thank you again. I actually changed my user privileges from the tutorial at Change User Rights Assignment Security Policy Settings in Windows 10 & included Manage Auditing rights. However, now I see it could have been simpler.

    If I go to the Task Scheduler > Task Scheduler > Library & rt click on my batch file>Properties, I see an option to "Run with highest privileges". I didn't realize that was the same as "Run with Administrative Privileges", but I guess it is. That would have done the trick, wouldn't it? (I've also deleted the /MT switch).

    I don't have a log file. Should I be using one? Thank you again!!
      My ComputerSystem Spec

  3.    3 Weeks Ago #13

    There are lots of different privileges in Windows. Administrative privileges aren't the same as highest - just the default is different.

    Have a look here - I'd put all this in spoiler tags but we don't have them here - don't be put off by the length or detail of this post just see some boxes are different sizes

    This WhoAmI /all information default for standard user:
    Code:
    PRIVILEGES INFORMATION
    ----------------------
    
    Privilege Name                Description                          State
    ============================= ==================================== ========
    SeLockMemoryPrivilege         Lock pages in memory                 Disabled
    SeShutdownPrivilege           Shut down the system                 Disabled
    SeChangeNotifyPrivilege       Bypass traverse checking             Enabled
    SeUndockPrivilege             Remove computer from docking station Disabled
    SeIncreaseWorkingSetPrivilege Increase a process working set       Disabled
    SeTimeZonePrivilege           Change the time zone                 Disabled
    Right click and "Run as Administrator"
    Code:
    PRIVILEGES INFORMATION
    ----------------------
    
    Privilege Name                            Description                                                        State
    ========================================= ================================================================== ========
    SeLockMemoryPrivilege                     Lock pages in memory                                               Disabled
    SeIncreaseQuotaPrivilege                  Adjust memory quotas for a process                                 Disabled
    SeSecurityPrivilege                       Manage auditing and security log                                   Disabled
    SeTakeOwnershipPrivilege                  Take ownership of files or other objects                           Disabled
    SeLoadDriverPrivilege                     Load and unload device drivers                                     Disabled
    SeSystemProfilePrivilege                  Profile system performance                                         Disabled
    SeSystemtimePrivilege                     Change the system time                                             Disabled
    SeProfileSingleProcessPrivilege           Profile single process                                             Disabled
    SeIncreaseBasePriorityPrivilege           Increase scheduling priority                                       Disabled
    SeCreatePagefilePrivilege                 Create a pagefile                                                  Disabled
    SeBackupPrivilege                         Back up files and directories                                      Disabled
    SeRestorePrivilege                        Restore files and directories                                      Disabled
    SeShutdownPrivilege                       Shut down the system                                               Disabled
    SeDebugPrivilege                          Debug programs                                                     Disabled
    SeSystemEnvironmentPrivilege              Modify firmware environment values                                 Disabled
    SeChangeNotifyPrivilege                   Bypass traverse checking                                           Enabled
    SeRemoteShutdownPrivilege                 Force shutdown from a remote system                                Disabled
    SeUndockPrivilege                         Remove computer from docking station                               Disabled
    SeManageVolumePrivilege                   Perform volume maintenance tasks                                   Disabled
    SeImpersonatePrivilege                    Impersonate a client after authentication                          Enabled
    SeCreateGlobalPrivilege                   Create global objects                                              Enabled
    SeIncreaseWorkingSetPrivilege             Increase a process working set                                     Disabled
    SeTimeZonePrivilege                       Change the time zone                                               Disabled
    SeCreateSymbolicLinkPrivilege             Create symbolic links                                              Disabled
    SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Disabled
    System:
    Code:
    PRIVILEGES INFORMATION
    ----------------------
    
    Privilege Name                  Description                                   State
    =============================== ============================================= ========
    SeAssignPrimaryTokenPrivilege   Replace a process level token                 Disabled
    SeIncreaseQuotaPrivilege        Adjust memory quotas for a process            Disabled
    SeTcbPrivilege                  Act as part of the operating system           Enabled
    SeSecurityPrivilege             Manage auditing and security log              Disabled
    SeTakeOwnershipPrivilege        Take ownership of files or other objects      Disabled
    SeLoadDriverPrivilege           Load and unload device drivers                Disabled
    SeProfileSingleProcessPrivilege Profile single process                        Enabled
    SeIncreaseBasePriorityPrivilege Increase scheduling priority                  Enabled
    SeCreatePermanentPrivilege      Create permanent shared objects               Enabled
    SeBackupPrivilege               Back up files and directories                 Disabled
    SeRestorePrivilege              Restore files and directories                 Disabled
    SeShutdownPrivilege             Shut down the system                          Disabled
    SeDebugPrivilege                Debug programs                                Enabled
    SeAuditPrivilege                Generate security audits                      Enabled
    SeSystemEnvironmentPrivilege    Modify firmware environment values            Disabled
    SeChangeNotifyPrivilege         Bypass traverse checking                      Enabled
    SeUndockPrivilege               Remove computer from docking station          Disabled
    SeManageVolumePrivilege         Perform volume maintenance tasks              Disabled
    SeImpersonatePrivilege          Impersonate a client after authentication     Enabled
    SeCreateGlobalPrivilege         Create global objects                         Enabled
    SeTrustedCredManAccessPrivilege Access Credential Manager as a trusted caller Disabled
    TrustedInstaller
    Code:
    PRIVILEGES INFORMATION
    ----------------------
    
    Privilege Name                            Description                                                        State
    ========================================= ================================================================== ========
    SeAssignPrimaryTokenPrivilege             Replace a process level token                                      Disabled
    SeLockMemoryPrivilege                     Lock pages in memory                                               Enabled
    SeIncreaseQuotaPrivilege                  Adjust memory quotas for a process                                 Disabled
    SeTcbPrivilege                            Act as part of the operating system                                Enabled
    SeSecurityPrivilege                       Manage auditing and security log                                   Disabled
    SeTakeOwnershipPrivilege                  Take ownership of files or other objects                           Disabled
    SeLoadDriverPrivilege                     Load and unload device drivers                                     Disabled
    SeSystemProfilePrivilege                  Profile system performance                                         Enabled
    SeSystemtimePrivilege                     Change the system time                                             Disabled
    SeProfileSingleProcessPrivilege           Profile single process                                             Enabled
    SeIncreaseBasePriorityPrivilege           Increase scheduling priority                                       Enabled
    SeCreatePagefilePrivilege                 Create a pagefile                                                  Enabled
    SeCreatePermanentPrivilege                Create permanent shared objects                                    Enabled
    SeBackupPrivilege                         Back up files and directories                                      Disabled
    SeRestorePrivilege                        Restore files and directories                                      Disabled
    SeShutdownPrivilege                       Shut down the system                                               Disabled
    SeDebugPrivilege                          Debug programs                                                     Enabled
    SeAuditPrivilege                          Generate security audits                                           Enabled
    SeSystemEnvironmentPrivilege              Modify firmware environment values                                 Disabled
    SeChangeNotifyPrivilege                   Bypass traverse checking                                           Enabled
    SeUndockPrivilege                         Remove computer from docking station                               Disabled
    SeManageVolumePrivilege                   Perform volume maintenance tasks                                   Disabled
    SeImpersonatePrivilege                    Impersonate a client after authentication                          Enabled
    SeCreateGlobalPrivilege                   Create global objects                                              Enabled
    SeIncreaseWorkingSetPrivilege             Increase a process working set                                     Enabled
    SeTimeZonePrivilege                       Change the time zone                                               Enabled
    SeCreateSymbolicLinkPrivilege             Create symbolic links                                              Enabled
    SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Enabled
    What the tutorial you quoted explains is how to enable privileges that are normally disabled under the context in which you are running. You can if you want enable them all (as long as your account is part of the administrators group). For robocopy backup you don't need everything - just the /COPYALL switch requires permissions standard user doesn't have by default - running as Administrator is sufficient to copy the security data.

    As for whether you want a logfile that is up to you. I use one (with most details suppressed - see below) so I can see if and when it worked. I delete old log files every few months when I remember.

    It is definitely good for testing - just put this on the end of your statement - you can remove it later if you don't want to check the logs or have them taking up space:

    /NFL /NDL /LOG:C:\Temp\whatever.log
      My ComputerSystem Spec


  4. Posts : 78
    windows 10 professional 64-bit
    Thread Starter
       3 Weeks Ago #14

    lx07 said: View Post
    There are lots of different privileges in Windows. Administrative privileges aren't the same as highest - just the default is different....
    ---------------------------------------------------cut------------------------------

    As for whether you want a logfile that is up to you. I use one (with most details suppressed - see below) so I can see if and when it worked. I delete old log files every few months when I remember.

    It is definitely good for testing - just put this on the end of your statement - you can remove it later if you don't want to check the logs or have them taking up space:

    /NFL /NDL /LOG:C:\Temp\whatever.log
    Thank you again. I didn't see an option to just "Run as administrator" in the Task Scheduler, which is why I checked "highest privilege". In any event, you're a wealth of knowledge!!
      My ComputerSystem Spec

  5.    3 Weeks Ago #15

    phrab said: View Post
    Thank you again. I didn't see an option to just "Run as administrator" in the Task Scheduler, which is why I checked "highest privilege"
    You are quite correct.

    I seem to have been answering some slightly different question that you didn't ask. Sorry about that.

    In task scheduler the "Run with the highest privileges" box means if the user (defined just above in the "When running the task, use the following account" box) is part of the Administrators group then it will run with the administrator privileges. If it is a standard user it will not as a standard user doesn't have an elevated security token to aspire to.

    This explains it better: How does "Run with the highest privileges" really work in Task Scheduler ?

    So if your user is part of Administrators group then scheduling a task like that will be the same as doing the right click and run as administrator on cmd.exe and typing the robocopy command in manually.
      My ComputerSystem Spec


  6. Posts : 216
    Windows 10 Pro x64
       3 Weeks Ago #16

    lx07 said: View Post
    Therefore I'd change this:
    Robocopy "C:\Users\Phil\AppData\Roaming\Thunderbird\Profiles\MyProfile" "E:\Backups\Thunderbird\Profiles\MyProfile" /MIR /Z /W:5 /TS /MOT:180 /R:10 to:
    Robocopy "C:\Users\Phil\AppData\Roaming\Thunderbird\Profiles\MyProfile" "E:\Backups\Thunderbird\Profiles\MyProfile" /MIR /COPYALL /R:0 /W:0

    I totally agree with the comments made by @lx07.
    Just to add, that if you want to have an exact mirror of your files you should also add the /DCOPY:T switch to copy the date/time of the folders too.
    Regarding the RoboCopy's /MT option disabling /NP switch, the problem does not exist anymore.

    If it can be of any help this the command I use:
    (Since I backup to an external disk, I start by confirming the Drive letter of the external disk, which you can omit, if you have a fixed disk where you backup and change the %drive% with your drive's letter E:, F: etc.)

    Code:
    set /P Drive="Drive to perform the backup (E: F: G: etc.) "
    RoboCopy "%userprofile%\Documents" "%Drive%\Backup\Documents" /MIR /COPYALL /DCOPY:T /XJ /MT:16 /R:0 /W:0 /UNILOG+:"C:\Backup\backup.log" /TEE /NP /FP /NDL /BYTES
      My ComputerSystem Spec


  7. Posts : 78
    windows 10 professional 64-bit
    Thread Starter
       3 Weeks Ago #17

    ddelo said: View Post
    I totally agree with the comments made by @lx07.
    Just to add, that if you want to have an exact mirror of your files you should also add the /DCOPY:T switch to copy the date/time of the folders too.
    Regarding the RoboCopy's /MT option disabling /NP switch, the problem does not exist anymore.

    If it can be of any help this the command I use:
    (Since I backup to an external disk, I start by confirming the Drive letter of the external disk, which you can omit, if you have a fixed disk where you backup and change the %drive% with your drive's letter E:, F: etc.)

    Code:
    set /P Drive="Drive to perform the backup (E: F: G: etc.) "
    RoboCopy "%userprofile%\Documents" "%Drive%\Backup\Documents" /MIR /COPYALL /DCOPY:T /XJ /MT:16 /R:0 /W:0 /UNILOG+:"C:\Backup\backup.log" /TEE /NP /FP /NDL /BYTES
    Thank you for this additional information; I appreciate your time. Of course, this raises a couple questions.

    1) In reading the robocopy options, I notice that this is for directories (folders, I presume), rather than files. Under "Date modified", I notice that the date listed does change. Is this something different than the timestamp for folders? i.e. I'm not sure what it does. I'm also not sure whether copying the D (Data) & A (Attributes) is needed, as well as the timestamp.

    2) I copy to 1 of 2 different external drives on different weeks (D & E). I've been manually modifying the code every week (not difficult really). But is there a way for Robocopy to copy to whichever drive is connected? i.e. D:\etc. or E:\etc.

    Thank you again!
      My ComputerSystem Spec


  • Posts : 216
    Windows 10 Pro x64
       3 Weeks Ago #18

    1. The /DCOPY:T switch copies the timestamp of each copied directory (= folder). The D,A are not needed as they are copied by the /MIR switch.

    2. That is done by the first line I use:
    set /P Drive="Drive to perform the backup (E: F: G: etc.) "
    i.e prompts the user to enter the drive letter of the external disk and saves it in the variable %Drive%, which is then used in the RoboCopy command.
      My ComputerSystem Spec


  • Posts : 78
    windows 10 professional 64-bit
    Thread Starter
       3 Weeks Ago #19

    ddelo said: View Post
    i.e prompts the user to enter the drive letter of the external disk and saves it in the variable %Drive%, which is then used in the RoboCopy command.
    Thank you again for this additional information. It's good to know, but I won't be able to use this, as I run this late at night when I'm not at the computer. I've learned a lot.
      My ComputerSystem Spec


  • Posts : 78
    windows 10 professional 64-bit
    Thread Starter
       2 Weeks Ago #20

    ddelo said: View Post
    1. The /DCOPY:T switch copies the timestamp of each copied directory (= folder). The D,A are not needed as they are copied by the /MIR switch.
    For what it's worth, I used Robocopy on my 2nd machine, a WinXP SP-3 machine. When I tried to create a logfile, the /DCOPY:T switch prevented the logfile from being created...even if I made it /DCOPY:TDA. I guess it works somewhat differently in WinXP.
      My ComputerSystem Spec


  •  
    Page 2 of 4 FirstFirst 1234 LastLast

    Related Threads
    Hello, Happy new year. I have a couple PC's in my house running Windows 10 64bit. All these PC's run Windows from a SSD and have a 2nd HD installed. To save space on the SSD's I put the paging file for the virtual ram on the 2nd HD. So now,...
    Solved Win+X doesn't work anymore in General Support
    pressing Win+X doesn't show the power user menu for me anymore. right clicking Start button doesn't work either, but when I do it, the mouse cursor jumps several pixels up and to the right. I did sfc /scannow and it didn't fix the issue. does...
    Scroll wheel doesn't work anymore in Drivers and Hardware
    Hi, i've been searching this issue on Google with literal no topic about it so i'll just make the first one here: From a time i have an A4Tech V7 Gaming mouse that works perfect in Windows 7. Since a few weeks ago, after Microsoft deployed a...
    I'm used to run files by drag'n'dropping them on top of one of the icons in quicklaunch. When I need to launch file with some app, while file is associated with another, or just use the other version of app. E.g. drag and drop png file on Paint icon...
    I want to run Robocopy to copy my Money 2005 file every shutdown, I know Money has a backup facility but when my wife runs Money on her laptop (Using Homegroup) there is always a backup conflict with my PC and if I open Money and try to backup I get...
    Our Sites
    Site Links
    About Us
    Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    © Designer Media Ltd
    All times are GMT -5. The time now is 01:58.
    Find Us