我正在使用robocopy將所有文件和文件夾從一個目錄複製到另一個目錄。 每次腳本執行時,該目錄都將被複制到一個新的帶時間戳的文件夾中。批量使用robocopy找不到目的地目錄
但是我收到follwoing錯誤:
No destination directory Specfied
下面是代碼:
echo off
set newDirectory = C:\Users\cmooney\Desktop
set DirName=%date:~-4,4%.%date:~-7,2%.%date:~0,2%.%time:~0,2%.%time:~3,2%
MD \%newDirectory%
set source = C:\Users\cmooney\Desktop\FolderA
rem /e copy all subdirs /z try again if fails /NMir copy only new files
robocopy %source% %DirName% /e /z /Mir
rem leave cmd line open
pause
REM If there are no changes, robocopy will not copy anything. If you have tried
REM and it worked, .... if no changes, no file copy.
任何輸入讚賞
'MD%newDirectory%\%Dirname%' – Squashman
'%newDirectory%'和'%source%'沒有被定義,因爲'SET'命令中有空格。 –