title: Comparing two seemingly identical variables does not trigger if statement BATCH-file
body: <p>I'm writing a simple scrip to check if my git branch is up to date, but when I try to compare the output from git status with my predefined string the if statement never trigger even though echo %%i and displays the exact same string I'm comparing against.</p>
  
  <pre><code>   SETLOCAL ENABLEDELAYEDEXPANSION
  
     echo off
     D:
     cd D:\GitHub\goworkspace\src\Programvareutvikling
     set cmd="git status -uno"
     set msg=Your branch is up-to-date with 'origin/Server'.
     FOR /F "tokens=*" %%i IN (' %cmd% ')  DO ( 
     REM this line never triger even when it seems like it should
     set X=%%i
     IF  !X! == %msg% Echo uptodate
     )
  
     pause
  </code></pre>
  
  <p>Any help would be appreciated; this is my first question on stack exchange so please tell me if I'm doing anything wrong. Alternate solutions is also appreciated, but I'd prefer not having to install additional programs.</p>
  
  <p>This is the output:</p>
  
  <pre><code>echo %msg% &gt;Your branch is up-to-date with 'origin/Server'.
  echo !X!  &gt;Your branch is up-to-date with 'origin/Server'.
  echo %msg% &gt;Your branch is up-to-date with 'origin/Server'.
  echo !X!  &gt;nothing to commit (use -u to show untracked files)
  Press any key to continue . . .
  </code></pre>
  
  <p>Solution: I was not using quotes around the variables.</p>
  
  <pre><code>    IF /I "%%~i"=="%msg%" Echo uptodate
  </code></pre>