@echo off setlocal enabledelayedexpansion set "reference_file=参考文件.txt" set "replacement_content=替换的内容" for /r %%F in () do ( if not "%%~nxF"=="%~nx0" ( echo Processing file: %%F set "temp_file=%%~dpFtemp.txt" findstr /n "^" "%%F" > "!temp_file!" for /f "delims=: tokens=1," %%A in ('type "!temp_file!"') do ( set "line=%%B" findstr /x "!line!" "%reference_file%" >nul if !errorlevel! equ 0 ( echo Replacing line: "!line!" in file: %%F echo %replacement_content%>>"%%F" ) ) del "!temp_file!" ) ) endlocal


原文地址: https://www.cveoy.top/t/topic/pCfd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录