I think I ran into a bug in Window's batch scripting.
I cannot set variables that are in an expanded if statement.
Here is an isolated part of my script:
@echo off
set success=1
set Version=12345
set Target=Client
set Type=456
set dir=
set zip=
if "%Version%"=="" set success=0
if "%Type%"=="" set success=0
if 1==1 set test=42
if %success%==1 (
    set test2=57005
    if "%Target%"=="Client" (
        set dir=ModName v%Version%
        set zip=ModName v%Version% %Type%.zip
        echo Version: %Version%
        echo    Type: %Type%
        echo.
        echo  Target: %Target%
        echo     dir: %dir%
        echo     zip: %zip%
        echo.
        echo    test: %test%
        echo   test2: %test2%
    )
) else (
    echo Not successful.
)
This is the output from a brand new instance of cmd:
C:\Users\RandomClown\Desktop>test.bat
Version: 12345
   Type: 456
 Target: Client
    dir:
    zip:
   test: 42
  test2:
What you should notice is that the single line if statement correctly sets stuff.
The multiline if will perform anything that is NOT a set. I dont think I missed anything.
Also, the multiline if statement is correctly executing the right lines, as the else ( echo Not successful. ) lines did not execute.
Why did the lines not execute?
 
     
     
     
    