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:
@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. > ygg.new
for /F "delims=\= tokens=1,2" %%k in (Ygg.ini) do (
if "%%k" NEQ "MagickPath" GOTO P1
)
:P2
>>ygg.new echo %%k=%PATH%
GOTO SECONDEND
:P1
>>ygg.new echo %%k=%%L
GOTO SECONDEND
:SECONDEND
del Ygg.ini
ren ygg.new Ygg.ini
this bat will only export if ygg.ini exists, and will output %k=<path>
instead of what I want, which is MagickPath=<path>
. 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).
I have a repository set up here: https://github.com/yggdrasil75/Ygg-Scripts/blob/master/YggLoadScreens.pas which shows the full code of the pascal script that will be executing the bat file.