Ask a question, in the WIN10 system, I want to use the robocopy command to back up two folders. The first Desktop can be backed up normally, and the second and third quoted "Saved Games" and "Burn\Burn" folders cannot be backed up. The command is as follows:
for %%a in (Desktop "Saved Games" "Burn\Burn") do if not exist D:\Users\%username%\%%a robocopy "%USERPROFILE%\%%a" "D:\Users\%username%\%%a" /e
The error content after the robocopy command is executed is as follows:
Source: C:\Users\Administrator"Saved Games"\
Destination: D:\Users\Administrator"Saved Games"\
Source: C:\Users\Administrator"Burn\Burn"\
Destination: D:\Users\Administrator"Burn\Burn"\
How to solve it, thank you!
Solved, the method is as follows:
Use %%~a, add quotes to the if judgment path "complete path"
for %%a in (Desktop "Saved Games" "Burn\Burn") do if not exist "D:\Users\%username%\%%~a" robocopy "%USERPROFILE%\%%~a" "D:\Users\%username%\%%~a" /e
[ Last edited by hbby on 2019-5-5 at 11:07 ]
for %%a in (Desktop "Saved Games" "Burn\Burn") do if not exist D:\Users\%username%\%%a robocopy "%USERPROFILE%\%%a" "D:\Users\%username%\%%a" /e
The error content after the robocopy command is executed is as follows:
Source: C:\Users\Administrator"Saved Games"\
Destination: D:\Users\Administrator"Saved Games"\
Source: C:\Users\Administrator"Burn\Burn"\
Destination: D:\Users\Administrator"Burn\Burn"\
How to solve it, thank you!
Solved, the method is as follows:
Use %%~a, add quotes to the if judgment path "complete path"
for %%a in (Desktop "Saved Games" "Burn\Burn") do if not exist "D:\Users\%username%\%%~a" robocopy "%USERPROFILE%\%%~a" "D:\Users\%username%\%%~a" /e
[ Last edited by hbby on 2019-5-5 at 11:07 ]
