title: how to use goto in batch script
body: <p>I have written following code</p>
  
  <pre><code>setlocal
  
  set /A sample =1 
  
  :first
  
  type C:\test.txt | find "inserted"
  
  if %ERRORLEVEL% EQU 0 goto test
  
  if %ERRORLEVEL% EQU 1 goto exam
  
  :test
  
  echo "testloop" &gt;&gt; C:\testloop.txt
  
  set /A sample = %sample% + 1 
  
  if %sample% LEQ 4 goto first
  
  :exam
  
  echo "exam loop" &gt;&gt; C:\examloop.txt
  
  endlocal
  </code></pre>
  
  <p>but it is going to lable "exam" even though error level is not equal to "1" plz help me</p>