@echo off
rem 第三象限04
rem 2015年11月7日
rem 此处将%1替换为目标文件 路径名字
set source=%1
rem aaa bbb为匹配的关键字
set fextion=aaa bbb
set tempfile1=%temp%\tempfile1.log
set tempfile2=%temp%\tempfile2.log
if not exist %source% echo 读取文件不存在&pause>nul&exit /b 1
if exist %tempfile1% 0 0>%tempfile1% 2>nul
if exist %tempfile2% 0 0>%tempfile2% 2>nul
echo 正在匹配关键字
type %source%|findstr "%fextion%" >>%tempfile1%
for /f "tokens=1 delims=-" %%i in (%tempfile1%) do @(
echo %%i
)>>%tempfile2%
echo %source%目标包含%fextion%的字符行已全部存放%tempfile2%中
echo 是否查看(默认不查看)
choice /t 3 /d n
if "%errorlevel%"=="2" pause&exit /b 0
type %tempfile2%
pause
最后取出的信息在%temp%\tempfile2.log 中