本帖最后由 went 于 2022-4-15 20:41 编辑
test.bat
ansi编码,修改4-5行- @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- REM 源目录和目标目录
- set "src_dir=F:\code"
- set "dest_dir=\\172.28.176.1\123"
- for /d %%i in ("%src_dir%\*") do (
- pushd "%%i"
- for /r %%a in (*.txt) do (
- set "line=#%%a"
- for /f "delims=" %%b in ("!line:#%src_dir%=%dest_dir%!") do (
- mkdir "%%~dpb" 2>nul
- echo %%a
- echo %%b
- copy /y "%%a" "%%b"
- echo -------------
- )
- )
- popd
- )
- pause&exit
复制代码
|