中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-27 05:46
47,812 topics / 349,912 posts / today 2 new / 48,264 members
其它操作系统综合讨论区 » [Solved] About the problem of using robocopy to back up data
Printable Version  6,083 / 0
Floor1 hbby Posted 2019-05-02 12:05
中级用户 Posts 99 Credits 220
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 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023