我必須使用.bat文件備份包含3個文件夾的文件夾。結構是MainFolder \ First Folder,MainFolder \ Second Folder,MainFolder \ Third Folder。我想備份爲MainFolder \ 30-04-2015 \ FirstFolder,MainFolder \ 30-04-2015 \ SecondFolder,MainFolder \ 30-04-2015 \ ThirdFolder。創建如何通過.bat文件在文件夾中創建文件夾
@echo off
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%dd%-%mm%-%yyyy%
mkdir "Z:\MainFolder\%1%date%"
xcopy "C:\MainFolder\FirstFolder" "Z:\MainFolder\%date%\FirstFolder" /s/i
xcopy "C:\MainFolder\SecondFolder" "Z:\MainFolder\%date%\SecondFolder" /s/i
xcopy "C:\MainFolder\ThirdFolder" "Z:\MainFolder\%date%\ThirdFolder" /s/i
只有日期文件夾,沒有文件在其複製 - 含
MY .bat文件。
請給解答。
此行中的'%1'是錯字'mkdir'Z:\ MainFolder \%1%date%「'? – aphoria