发布网友 发布时间:2022-04-26 23:52
共1个回答
热心网友 时间:2022-06-20 11:51
试试下面的代码,测试通过后把mydbg=echo中的echo删除即可。source和target跟进须要修改)分别对应你的d:\a和e:\test
)
123456710111213@echo off & setlocal enabledelayedexpansionset "mydbg=echo"set "source=d:\a"set "target=e:\test"for /f "delims=" %%a in ('dir /s /b /a-d %source%\2014.*') do ( set "folder=%%~da%%~pa" set folder=!folder:%source%\=%target%\! set "file=%%~na%%~xa" if not exist "!folder!" %mydbg% md "!folder!" echo copy "%%a" ^=^=^> "!folder!" %mydbg% copy /y "%%a" "!folder!")endlocal & @echo on