如何用bat 替换txt文本中的指定字符串 获取当前文件夹的字符串 替换

如何用bat 替换txt文本中的指定字符串 获取当前文件夹的字符串 替换
qwrewretry1234/1.bat

bat 中有123423546txt
将123423546txt字符串 修改为qwrewretry1234。
谢谢

放在qwrewretry1234目录中执行。

@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
温馨提示:答案为网友推荐,仅供参考
相似回答