我需要识别文件夹中所有以 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)