title: write path variable to ini using bat file
body: <p>I an attempting to write a bat file that will find a path variable, or at the very least, find all path variables. 
  I want to be able to find where ImageMagick is stored so that I can run it using a pascal script in xEdit for skyrim, currently I have this:</p>
  
  <pre><code>@ECHO off
  
  IF "%PATH%" == "Magick.exe" GOTO NOPATH
  :YESPATH
  PATH=%PATH%
  @ECHO %PATH%
  GOTO END
  :NOPATH
  @ECHO false
  PATH=C:\DOS;
  GOTO END
  :END
  echo. &gt; ygg.new
  for /F "delims=\= tokens=1,2" %%k in (Ygg.ini) do (
      if "%%k" NEQ "MagickPath" GOTO P1
  )
  
  :P2
      &gt;&gt;ygg.new echo %%k=%PATH%
      GOTO SECONDEND
  :P1
      &gt;&gt;ygg.new echo %%k=%%L
      GOTO SECONDEND
  :SECONDEND
  del Ygg.ini
  ren ygg.new Ygg.ini
  </code></pre>
  
  <p>this bat will only export if ygg.ini exists, and will output <code>%k=&lt;path&gt;</code> instead of what I want, which is <code>MagickPath=&lt;path&gt;</code>. I would like to be able to automatically create the file if it doesnt exist, as well as the section it should be in (BaseData).</p>
  
  <p>I have a repository set up here: <a href="https://github.com/yggdrasil75/Ygg-Scripts/blob/master/YggLoadScreens.pas" rel="nofollow noreferrer">https://github.com/yggdrasil75/Ygg-Scripts/blob/master/YggLoadScreens.pas</a> which shows the full code of the pascal script that will be executing the bat file.</p>