本帖最后由 aloha20200628 于 2024-12-25 16:10 编辑
回复 1# jave000
给一个批处版本》将当前目录下的每个 *.txt 文件中的首行(假定首行不能是空行)作关键词替换并覆写源文件...- @echo off &setlocal enabledelayedexpansion
- for /f "delims=" %%F in ('dir /b/a-d *.txt') do (
- set/p "a="<"%%F" &set "a=!a:config=gen!"
- more +1 "%%F">"_.2" &echo,!a!>"_.1" © /y _.1+_.2 "%%F")>nul
- del /q _.1 _.2 &pause&exit/b
复制代码
|