What is wrong with this code? It says ECHO is off
.
@ECHO off
set /p pattern=Enter id:
findstr %pattern% .\\a.txt > result
if %errorlevel%==0 (
se
The solution for your problem is to put the "echo"s after the if block is completed. Try this:
@ECHO off
set /p pattern=Enter id:
findstr %pattern% .\a.txt > result
if %errorlevel%==0 (
set var2= test.txt
echo %var1%
:result
del result
pause
This way you can see the solution as you wanted. Cheers! ;]