title: Batch file doesn't enters if statement
body: <p>I'm having problem with a batch file that I wrote, it suppose to detect when a process A isn't running and then kill process B. I check if process A exists with wmic (and loop over it while this is the case) and when I detect that it isn't running I just use taskkill on the other process. The problem is that it doesn't enter the if statement for some reason although the values seem to be equal..</p>
  
  <pre><code>SETLOCAL EnableExtensions
  set EXE=python.exe
  
      :RUNNERON
      FOR /F "skip=1 delims=" %%x IN ('wmic process where "CommandLine Like '%%some text to match%%' and Caption='python.exe'" get caption') DO for /F "delims=" %%j in ("%%x") do (
  
          echo Current process name: %%j   :: This prints "python.exe"
          echo Required process is: %EXE%  :: This prints "python.exe"
          IF %%j == %EXE% (
              echo inside if
              goto RUNNERON
          ) ELSE (
              echo inside else
          )
      )
      echo Runner is done - killing watchdog process
      taskkill /F /im "pythonw.exe"
  
      pause
  </code></pre>
  
  <p>In task manager I have the python.exe process that matches the wmic condition up and running so it should be stuck in the loop but for some reason, the "inside else" is being printed to the console, I dont know what I'm doing wrong, it seems like it something in the way I compare the two..</p>
  
  <p>Thank you</p>
  
  <p>EDIT: 
  I solved it, the problem was in the "delims" in the first for loop.. once I removed it everything worked fine.
  So to conclude - this is the working "for" line:</p>
  
  <pre><code>FOR /F "skip=1" %%x IN ('wmic process where "CommandLine Like '%%forking import main%%' and Caption='python.exe'" get caption') DO for /F "delims=" %%j in ("%%x") do (
  </code></pre>