我需要识别文件夹中以US_开头的所有文件,然后将这些文件复制到多个编号的文件夹中。
我正在使用以下代码进行复制,但无法弄清楚如何识别要复制的文件。之前已定义%ROOTPATH%:
ECHO Which workstation are you copying user settings FROM?
SET /p WSFROM="Workstation Number?: "
ECHO Enter a range (eg. 5, eg. 10-15)
SET /p WSTO="Workstation Numbers?: "
for /f "usebackq delims=- tokens=1,2" %%a in ('%WSTO%') do (
set "LOWERWS=%%a"
set "UPPERWS=%%b"
)
if not "%UPPERWS%"=="" goto :copy_range
:copy_range
FOR /L %%i IN (%LOWERWS%, 1, %UPPERWS%) DO (
xcopy %ROOTPATH%\WORKSTATIONS\%WSFROM%\US_*.DAT %ROOTPATH%\WORKSTATIONS\%%i\US_*.DAT %%G)
答案 0 :(得分:0)
此行应与您的代码一起使用:
xcopy "%ROOTPATH%\WORKSTATIONS\%WSFROM%\US_*.DAT" "%ROOTPATH%\WORKSTATIONS\%%i\"