第一个这是
@echo off
:start
set "now=%cd%"
set /p batch=拖入要处理的文件夹:
pushd "%batch%" || goto start
if not defined batch goto start
for /f "tokens=* delims=" %%i in ('dir /s /b /a-d *.txt') do (find "天使的翅膀" "%%i">nul && echo %%j>>file_temp)
move "%batch%\file_temp" "%now%\Result.txt" >nul
echo 全部完成^!
start "" "%now%\Result.txt"
pause>nul
goto :eof
这是第二个
@echo off
:start
set "now=%cd%"
set /p batch=拖入要处理的文件夹:
pushd "%batch%" || goto start
if not defined batch goto start
for /f "tokens=* delims=" %%i in ('dir /s /b /a-d *.txt') do (find "天使的翅膀" "%%i">nul && call :replace "%%i")
move "%batch%\file_temp" "%now%\Result.txt" >nul
echo 全部完成^!
start "" "%now%\Result.txt"
pause>nul
goto :eof
:replace //filename
for /f "tokens=* delims=" %%j in ("%~1") do (
echo %%j>>file_temp
for /f "tokens=* delims= usebackq" %%h in ("%%j") do (
set "n=%%h"
setlocal enabledelayedexpansion
set "n=!n:天使的翅膀=恶魔的双翼!"
echo.!n!>>"%%~dpnj_temp"
)
set /p=%%~j正在处理..
)
goto :eof
1、一行命令即可:findstr /mc:"天使的翅膀" *.txt>1.txt
2、最安全高效的办法是借助文本流命令行:sed -i "s/天使的翅膀/恶魔的双翼/g" *,txt
PS:sed.exe需要下载放在system32目录,没有的话留下邮箱我给你发过去。
BBdoc文档搜索工具支持word Excel pdf txt csv等各类文档内容快速搜索。