回复 1# lamcelot - @echo off
- setlocal enabledelayedexpansion
-
- set file=config.ini
-
- set "file=%file:"=%"
- for /f "delims=" %%b in ("%file%") do (
- set lujing=%%~dpb
- set name=%%~nxb
- )
- title %lujing% %name%
- echo %lujing%%name%
- pause
-
- set /p chazhao=输入查找内容(区分大小写)
-
- find "%chazhao%" "%file%"
- for /f "delims=" %%c in ('find "%chazhao%" "%file%" /c') do set jieguo=%%c
- set "jieguo=%jieguo:*txt: =%"
- echo %name%中包含“%chazhao%”的共有 %jieguo% 行。
-
- set /p tihuan=输入替换内容
-
- :check
- set /a num+=1
- if not exist "%lujing%new%num%_%name%" (
- copy nul "%lujing%new%num%_%name%"
- ) else (
- goto check
- )
- for /f "delims=] tokens=1*" %%i in ('find "" /v /n "%file%"') do (
- set str=%%j
- if "!str!"=="" (
- echo.
- ) else (
- echo;!str:%chazhao%=%tihuan%!
- )
- )>>"%lujing%new%num%_%name%"
- echo 处理完毕&pause>nul
- start "" "%lujing%new%num%_%name%"
复制代码
|