# 備份使用者資料夾 ###### tags: `windows`, `script` ``` cmd @echo off :: 要複製的目錄 set userDirPath=c:\Users :: 僅複製以下子目錄 set list=Desktop Documents Downloads Favorites :: 輸出備份的目錄 set backupDirPath=BackupUsers :: 建立目錄 mkdir %backupDirPath% :: 獲取目錄 dir /b %userDirPath% > %TEMP%\userID.txt FOR /F %%i in (%TEMP%\userID.txt) do ( echo 建立 %%i 資料夾 mkdir %backupDirPath%\%%i for %%l in (%list%) do ( echo = 開始同步 %%i %%l robocopy %userDirPath%\%%i\%%l %backupDirPath%\%%i\%%l /MIR /R:1 /W:3 /NDL /NJH /NFL /NJS /MT:2 ) ) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up