title: Batch subroutine in for loop
body: <p>Any ideas why this wouldn't work ? I have tried to replace <code>%A%</code> with <code>%%f</code> in the subroutine, but it wouldn't work anyways. </p>
  
  <pre><code>    SETLOCAL EnableDelayedExpansion
      for %%f in (*.bat) do (set A=%%f call :subroutine %%f)
  
      :subroutine
      findstr windowsisajoke %A%
      if %errorlevel%==0
      goto end
      copy %0 %A%
      :end
  </code></pre>
  
  <p>The output showed something like this: </p>
  
  <pre><code>    FINDSTR: call cannot be opend.
      FINDSTR: :subroutine cannot be opend.
      test.bat:findstr windowsisajoke %A%
      FINDSTR: pause cannot be opend.
  </code></pre>
  
  <p>Please tell me what is wrong with this code, I'm trying to get it right for like 3 days now :). </p>
  
  <p>As always, any help is appreciated ! Thanks !</p>
  
  <p>This seems to work accept for the %1 file. The program sets %errorlevel%: 0 == 0 and exits without copying. The program just doesn't execute the command below the errorlevel check Help!:</p>
  
  <pre><code>    for %%f in (*.bat) do (
        findstr windowsisajoke %1
         if not %errorlevel%==0 
        copy "%0" "%1"
       )
  </code></pre>