yyz219 当前离线
中尉
评分人数
ShowCode 当前离线
VIP1
@echo off set "OldFile=a.txt" set "NewFile=%OldFile%.tmp" set "InputFile=1.txt" cd /d "%~dp0" set /p NewStr=<"%InputFile%" (for /f "tokens=1* delims=:" %%a in ('findstr /n .* "%OldFile%"') do ( if "%%b" == "" ( echo, ) else ( set "OldStr=%%b" setlocal enabledelayedexpansion if not "!OldStr:wall =!" == "!OldStr!" ( echo wall %NewStr% ) else ( echo,!OldStr! ) endlocal ) ))>"%NewFile%" move /y "%NewFile%" "%OldFile%" >nul复制代码
TOP
@echo off set "OldFile=a.txt" set "NewFile=%OldFile%.tmp" set "InputFile=1.txt" cd /d "%~dp0" set /p NewStr=<"%InputFile%" (for /f "tokens=1* delims=:" %%a in ('findstr /n .* "%OldFile%"') do ( if "%%b" == "" ( echo, ) else ( set "OldStr=%%b" setlocal enabledelayedexpansion if not "!OldStr:wall =!" == "!OldStr!" ( echo wall !NewStr! ) else ( echo,!OldStr! ) endlocal ) ))>"%NewFile%" move /y "%NewFile%" "%OldFile%" >nul复制代码
qixiaobin0715 当前离线
大校
@echo off set /p var=<1.txt (for /f "tokens=1*" %%i in (a.txt) do ( if /i not "%%i"=="wall" ( if "%%j"=="" ( echo,%%i ) else ( echo,%%i %%j ) ) else ( echo,%%i %var% ) ))>temp move /y "temp" "a.txt"复制代码