- @echo off
- setlocal enabledelayedexpansion
- :#
- set /p var=请输入要找的内容:
- for /f "tokens=1*" %%a in ('findstr "!var!" a.txt') do (
- if "%%a"=="!var!" (
- echo,%%a& echo,%%b
- for /f "tokens=1*" %%i in ('findstr "!var:~-5!" a.txt') do (
- if not "%%i"=="!var!" echo,%%i&echo,%%j
- )
- )
- set var=#
- )
- if not "!var!"=="#" echo,输入查询错误
- goto #
复制代码
|