@echo off set /p ip=请输入编码: for /f "tokens=3" %%i in ('findstr "%ip%" a.bat') do set abc=%%i echo %abc% pause>nul :: 21003 12 :: 21004 13 :: 21005 17