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

Discus and support Robocopy syntax doesn't work in my batch file anymore in Windows 10 Support to solve the problem; There are lots of different privileges in Windows. Administrative privileges aren't the same as highest - just the default is different....... Discussion in 'Windows 10 Support' started by phrab, Mar 22, 2018.

  1. phrab Win User

    Robocopy syntax doesn't work in my batch file anymore


    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!!
     
    phrab, Mar 26, 2018
    #16
  2. lx07 Win User

    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.
     
  3. ddelo Win User
    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[/quote]
     
    ddelo, Mar 27, 2018
    #18
  4. phrab Win User

    Robocopy syntax doesn't work in my batch file anymore

    [/quote] 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!
     
    phrab, Mar 28, 2018
    #19
  5. ddelo Win User
    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.
     
    ddelo, Mar 28, 2018
    #20
  6. phrab Win User
    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.
     
    phrab, Mar 28, 2018
    #21
  7. phrab Win User
    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.
     
    phrab, Mar 29, 2018
    #22
  8. lx07 Win User

    Robocopy syntax doesn't work in my batch file anymore

    Hard to say - I was born in the 80's.

    Whether robocopy worked at that time I'd have to google (assuming Google predated XP which I don't know).

    I know my own little peeve with it (the 100%100%100% in the log file) isn't fixed in the last 20 years.
     
  9. ddelo Win User
    Are you using the /MT switch?
    Mind you that this switch was introduced in Win7, long later WinXP
     
    ddelo, Mar 29, 2018
    #24
  10. ddelo Win User
    To avoid the 100%100%100% in the log file, use the:
    /NP switch (No Progress - don't display percentage copied.)

    I'm using /TEE /NP /FP /NDL /BYTES and the log file is OK.
     
    ddelo, Mar 29, 2018
    #25
  11. lx07 Win User
    Thank you. It was really bugging me that.
     
  12. ddelo Win User
    You're very welcome. Glad I could help! *Smile
     
    ddelo, Mar 29, 2018
    #27
  13. phrab Win User

    Robocopy syntax doesn't work in my batch file anymore

    Sorry...I missed this. No, I'm not using the /MT switch. However, I put the /DCOPY:T with the other switches before the /LOG*Biggrin:\backups\etc.. When I put the switch after /LOG*Biggrin:\backups\etc., it seems to work. So I guess I goofed. I'll see if it works tomorrow.
     
    phrab, Mar 30, 2018
    #28
  14. phrab Win User
    I just put the /DCOPY:T switch at the end (on my Win10 machine). The log file was created, BUT when I opened it, I got this message on 2 of the log files:
    "Copying NTFS Security to Destination Directory D:\backups\FolderName\This security ID may not be assigned as the owner of this object."
    Not sure what's going on.
     
    phrab, Mar 30, 2018
    #29
  15. ddelo Win User
    It seems that the destination file permissions cannot be set by your account.

    I would suggest two options:
    1. Check this: This security ID may not be assigned as the owner of this object. or
    2. Add the /B switch (to run in Backup mode)
     
    ddelo, Mar 30, 2018
    #30
Thema:

Robocopy syntax doesn't work in my batch file anymore

Loading...
  1. Robocopy syntax doesn't work in my batch file anymore - Similar Threads - Robocopy syntax doesn't

  2. Simple batch file gets syntax error

    in Windows 10 Gaming
    Simple batch file gets syntax error: My one-line batch file gets the error message :The syntax of the command is incorrect. I'm pretty sure this is not so.As in so many many other cases, Microsoft gives a generic error message that has no apparent connection to what the user is trying to do. As a result, we...
  3. Simple batch file gets syntax error

    in Windows 10 Software and Apps
    Simple batch file gets syntax error: My one-line batch file gets the error message :The syntax of the command is incorrect. I'm pretty sure this is not so.As in so many many other cases, Microsoft gives a generic error message that has no apparent connection to what the user is trying to do. As a result, we...
  4. Can Robocopy copy in batches of files?

    in Windows 10 Gaming
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  5. Can Robocopy copy in batches of files?

    in Windows 10 Software and Apps
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  6. Can Robocopy copy in batches of files?

    in Windows 10 Network and Sharing
    Can Robocopy copy in batches of files?: Evening, I'm just after a bit of help, I have a folder on my PC which has a load of files from my Nikon Camera - for my current example 1700 at around 42GB, I usually copy these to an external SDD but I'm guessing due to the SSD the speed tends to drop off so I start around...
  7. HOW: Robocopy command to a batch-file

    in Windows 10 Network and Sharing
    HOW: Robocopy command to a batch-file: This working fine in a Command Prompt: robocopy "C:\¤Head Folder\Folder 01\Old folder" "C:\¤Head Folder\Folder 01\New folder" /mov /minage:930 How do I make a Batch file .BAT with that RoboCopy command...
  8. Robocopy Syntax required

    in Windows 10 Installation and Upgrade
    Robocopy Syntax required: Hi I have a shortcut with the following script C:\Windows\SysWOW64\Robocopy.exe /MIR "C:\Users\Jandd\AppData\Local\Google\Chrome\User Data\Default" J:\CHROME_BOOKMARKS_BACKUP /SEC Bookmark* Under Windows 7 this script copied the two Bookmarks files and put them in my...
  9. Robocopy Syntax Required

    in Windows 10 Software and Apps
    Robocopy Syntax Required: Hi I have a Robocopy script for backing up my files. It always worked ok under Windows 7 but since I upgraded to Windows 10 it is now treating every file as "modified" so it takes a lot longer to backup my files. My script is: C:\Windows\SysWOW64\Robocopy.exe I:\DATA...
  10. Wildcards in Robocopy | Batch file very very basics

    in Windows 10 Support
    Wildcards in Robocopy | Batch file very very basics: I have folders that contain files and subfolders. The files have a limited set of extensions. What I seek to do is to robocopy /mir the files separately from the subfolders. I have been trying to review wildcard basics. I am not finding any ways to combine them that suits...