Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Robocopy: Backup rights on Windows 7

📅 2009-Dec-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ robocopy, windows 7 ⬩ 📚 Archive

My Robocopy backup script has a few lines of:

robocopy D:\Source_Dir K:\Backup_Dir /MIR /B

This worked fine on Windows XP, but stopped working once I moved to Windows 7. Robocopy would give the following error:

ERROR : You do not have the Backup and Restore Files user rights.
*****  You need these to perform Backup copies (/B or /ZB).

Surprisingly, I would get this error even if I was logged onto an Administrator account!

The reason turned out to be that running in /B (Backup mode) requires permissions to open files without any security restrictions. With the UAC in Windows 7, even a normal invocation of cmd.exe by an Administrator account does not have these rights!

To run Robocopy in /B (Backup mode) one needs to start cmd explicitly with Administrator rights! To do this type cmd at the Start menu, right-click on cmd.exe and choose Run as Administrator. This works fine even from a non-Administrator account (assuming you know some Administrator credentials.)