本帖最后由 qixiaobin0715 于 2020-11-14 11:09 编辑
替换小说之类的较大的文本批处理效率可能不高,可考虑其它方式。- @echo off
- set /p g=请输入所谓的关键词:
- for %%a in (*.txt) do (
- (for /f "delims=" %%i in ('findstr /n .* "%%a"') do (
- set "str=%%i"
- setlocal enabledelayedexpansion
- set "str=!str:%g%=%%a!"
- set "str=!str:*:=!"
- echo,!str!
- endlocal
- ))>#%%a
- )
- pause
复制代码
|