@echo off
setlocal enabledelayedexpansion
for %%i in ("%TEMP%\145.TXT") do set file=%%~fi
echo.
set replaced= <!> <REG.EXE> <VERSION 3.0>
set all=
for /f "delims=" %%i in ('type "%file%"') do (
set str=%%i
set "str=!str:%replaced%=%all%!"
echo !str!>>"%file%"_tmp.txt
)
copy "%file%" "%file%"_bak.txt >nul 2>nul
move "%file%"_tmp.txt "%file%"
start "" "%file%"
set replaced= <!> <REG.EXE> <VERSION 3.0> 这段代码只能每次填入一小段才能过滤的掉。。。
@echo off
for /f "skip=2 delims=" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell\open\command"') do echo %%i
pause
@echo off
setlocal enabledelayedexpansion
for %%i in ("%TEMP%\145.TXT") do set file=%%~fi
echo.
for /f "delims=" %%i in ('type "%file%"') do (
set str=%%i
set "str=!str:* REG.EXE VERSION 3.0=!"
echo. !str!>>"%file%"_tmp.txt
)
copy "%file%" "%file%"_bak.txt >nul 2>nul
move "%file%"_tmp.txt "%file%"
start "" "%file%"
or:
call set "str=%%str:! REG.EXE VERSION 3.0=%%"
@echo off
setlocal enabledelayedexpansion
for %%i in ("%TEMP%\145.TXT") do set file=%%~fi
echo.
for /f "delims=" %%i in ('type "%file%"') do (
set str=%%i
call set "str=%%str:! REG.EXE VERSION 3.0=%%"
echo. !str!>>"%file%"_tmp.txt
)
copy "%file%" "%file%"_bak.txt >nul 2>nul
move "%file%"_tmp.txt "%file%"
start "" "%file%"