本帖最后由 77七 于 2024-4-28 12:01 编辑
- @echo off
- rem 批处理保存为ansi编码格式
- set f1=C:\Users\Administrator\Desktop\SYS
- set f2=C:\Users\Administrator\Desktop\SYS2
- set f3=C:\Users\Administrator\Desktop\SYS3
-
- for /f "tokens=1-2* delims= " %%a in ('robocopy "%f1%" "%f2%" /e /xc /xn /xo /l /x /fp ^|findstr /rb /c:" *新文件" /c:" *新目录"') do (
- echo 新文件\目录 [%%c]
- set file=%%c
- setlocal enabledelayedexpansion
- for /f "delims=" %%x in ("!file:%f1%=%f3%!") do (
- endlocal
- if exist "%%c\" (
- md "%%x" 2>nul
- ) else (
- md "%%~dpx" 2>nul
- copy "%%c" "%%x"
- )
- )
- )
- pause
复制代码
代码存在问题,更正 |