title: Write variables to file as %VAR% not as the value of the variable in BAT
body: <p>Write variables to file as %VAR% not as the value of the variable, as well ask making tasklist function properly when redirecting output.</p>
  
  <p>Code im using to write to file:</p>
  
  <pre><code>echo tasklist /FI "IMAGENAME eq %ZOEXT%" 2&gt;NUL | find /I /N "%ZOEXT%"&gt;NUL &gt;&gt; boot.bat
  echo if "%ERRORLEVEL%"=="1" start /d "%ZODIR%" %ZOEXT% &gt;&gt; boot.bat
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>tasklist /FI "IMAGENAME eq Zoiper.exe"  
  if "0"=="1" start /d "C:\Documents and Settings\mgladman\Desktop\Zoip\Zoiper Communicator\" Zoiper.exe 
  </code></pre>
  
  <p>What I want added to boot.bat:</p>
  
  <pre><code>tasklist /FI "IMAGENAME eq %ZOEXT%" 2&gt;NUL | find /I /N "%ZOEXT%"&gt;NUL
  if "%ERRORLEVEL%"=="1" start /d "%ZODIR%" %ZOEXT%
  </code></pre>
  
  <p>If you want i can publish whole code not just segment, it is a cool script :P Just has this small issue.</p>
  
  <p>Only "workaround" i can think is to make the first script, to echo echo in the first file and write the correct system data (this has to be a portable script, so that would work, but would be messy as)</p>