放到相关目录后运行。
@echo off & title 替换文本字符串 By 依梦琴瑶
cd /d %~dp0
set zfc=123423546txt
for %%a in ("%cd%") do set "dn=%%~nxa"
for %%a in (*.txt) do (
(for /f "delims=" %%b in ('type "%%~a"') do (
set "Str=%%~b"
call echo %%Str:%zfc%=%dn%%%
))>file$.tmp
move file$.tmp "%%~a" >nul
)
pause
运行后,就会把txt文本中指定的文字替换为当前目录名。