Why this code says echo is off?

前端 未结 5 1961
灰色年华
灰色年华 2021-02-05 01:46

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         


        
5条回答
  •  花落未央
    2021-02-05 02:43

    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! ;]

提交回复
热议问题