set file= set /p file= 請把要處理的文件拉到本窗口: set "file=%file:"=%" for %%i in ("%file%") do set "file=%%~fi" echo. set replaced= set /p replaced= 請輸入即將被替換的內(nèi)容: echo. set all= set /p all= 請輸入替換字符串: cd.>"%file%_tmp.txt" setlocal enabledelayedexpansion for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%file%"') do ( set str=%%j if not "!str!"=="" set "str=!str:%replaced%=%all%!" >>"%file%_tmp.txt" echo.!str! ) copy "%file%" "%file%_bak.txt" >nul 2>nul move "%file%_tmp.txt" "%file%" start "" "%file%"