title: Batch get variable's value
body: <p>I have the following code:</p>
  
  <pre><code>for /f "tokens=*" %%p in (input.txt) do (
  echo %%p
  cd %%p
  set /a c = 0
  for %%f in (*) do (
  echo %%f
  if not exist *test*.* (
  set /a c += 1
  )
  )
  if %%c GTR 0 echo %%p &gt;&gt;folders.txt
  cd ..
  )
  </code></pre>
  
  <p>But the last if statement is not working. I want to know what do I have to do to have access to the variable c that I set up in the first for. I've tried different combinations like !c! or %c% but nothing seems to work. What am I missing?</p>