I finally isolated my problem. Now I do have correct arguments for %verion%
and %ModName%
, it works earlier in the batch file. Also, the exact format of this if statement has been used successfully before in the same batch file (I am not sure about after). By placing statements that say if "file2exist"=="true" echo true
, I also know for a fact that it indeed has a value of "true"
. Now I put the code from last sentence in between lines 4 and 5, and the computer did the echo. This means that line 4 is somehow ignored? (Lines 1-3 and 10-11 work, lines 6-8 seem to be completely skipped)
What went wrong?
I thank you in advance. Any advice is greatly appreciated.
mkdir "0_%ModName%_Mod(%Version%)\"
mkdir "0_%ModName%_Mod(%Version%)\File1\"
echo.>"0_%ModName%_Mod(%Version%)\File1\Place_File_1_Here.txt"
if "file2exist"=="true" goto filetwostore
goto startbatting
:filetwostore
mkdir 0_%ModName%_Mod(%Version%)\File2\
echo.>"0_%ModName%_Mod(%Version%)\File2\Place_File_2_Here.txt"
:startbatting
echo Writing Batch File...
echo.>"Install-Uninstall.bat"
if "file2exist"=="true" goto filetwostore
is equivalent to
if 1==2 goto filetwostore
Two different strings can not be equal if, as said, they are different
Maybe, you need
if "%file2exist%"=="true" goto filetwostore
to compare the variable value, not the variable name