title: Batch file how to use findstr command to find a text and make it a variable?
body: <p>I want to know how to use Findstr command to find a text in a file and make it a variable here what i tried :</p>
  
  <pre class="lang-bat prettyprint-override"><code>@echo off
  for /F "delims=" %%a in ('findstr /I /m "100" Config.dat') do set "Variable=%%a"
  cls 
  if %errorlevel% == 0 (
  goto found
  ) else (
  goto nope
  )
  :found
  cls
  echo founded ! %Variable%
  pause
  exit
  :nope
  cls
  echo not found!
  pause
  exit
  </code></pre>
  
  <p>Ok i explain : In the 2nd line the number "100" is what i want to find and the "Config.dat" is the file that have in it the number 100 and some other numbers and the "Variable" in there is the name of the variable that i want to store in it 100.</p>
  
  <p>The problem is when it founded number 100 it goes to the function "found" and displays "Founded! 100" but when it not founded it also goes to "found" function and only display founded! without 100. So why when it didn't founded it it goes to "found" i need it to go to "nope".</p>
  
  <p>So i hope you guys explain to me if i did something wrong and thanks!</p>