This Script works well on Clean install but if it has an old version and I want it to check the variable gets broke someone in batch... I can type it in Command line and it works.
Script:
@echo off
REM Install / Upgrade 20-20 to Version 10.4.0.39
ECHO -- Verifying that Viewfinity 5.0.32.718 Agent is Installed --
if exist "C:\Program Files\Viewfinity\Agent\vf_agent.exe" GOTO VFCHECKVERSION
GOTO VFINSTALLAGENT
:VFCHECKVERSION
set VFCURRENTVERSION=5.0.32.718
FOR /F "tokens=2 delims==" %%G IN ('WMIC DATAFILE WHERE NAME^="C:\\Program Files\\Viewfinity\\Agent\\vf_agent.exe" get version /format:value') DO SET VIEWFINITYVERSION=%%G
IF %VIEWFINITYVERSION%==%VFCURRENTVERSION% GOTO CHECK2020VERSION
:VFINSTALLAGENT
ECHO -- Installing / UPgrading Viewfinity Agent to Version 5.0.32.718 --
msiexec /i "%~dp0\Viewfinity\VFAgentSetupX64.msi" /qn
PING 127.0.0.1 -n 15
GPUPDATE /FORCE
GOTO CHECK2020VERSION
:CHECK2020VERSION
if exist "C:\Program Files (x86)\20-20 Technologies\Design\Bin\System\Design.exe" GOTO 2020CHECKVERSION
GOTO 2020INSTALL
:2020CHECKVERSION
set 2020VERSION10_0=10.0.4.1049
set 22020VERSION10_1=10.1.1.23
set 2020VERSION10_2=10.2.0.37
set 2020VERSION10_3=10.3.0.31
set 2020CURRENTVERSION=10.4.0.39
FOR /F "tokens=2 delims==" %%G IN ('WMIC DATAFILE WHERE NAME^="C:\\Program Files (x86)\\20-20 Technologies\\Design\\Bin\\System\\Design.exe" get version /format:value') DO SET 2020VERSION=%%G
IF %2020VERSION%==%2020CURRENTVERSION% (GOTO Complete)
else IF %2020VERSION%==%2020VERSION10_0% (GOTO Uninstall_10.0.4.1049)
else IF %2020VERSION%==%2020VERSION10_1% (GOTO Uninstall_10.1.1.23)
else IF %2020VERSION%==%2020VERSION10_2% (GOTO Uninstall_10.2.0.37)
else IF %2020VERSION%==%2020VERSION10_3% (GOTO Uninstall_10.3.0.31)
:Uninstall_10.0.4.1049
ECHO -- Uninstalling 20-20 Design 10.0.4.1049 --
MsiExec.exe /X{1715404F-C357-480C-B62E-D498B352DCB3}
ECHO -- Uninstalling 20-20 CodeMeter 4.5 --
MsiExec.exe /X{DCC1DE01-B633-4CEE-8B6D-35B0BBA6AEE6}
:Uninstall_10.1.1.23
ECHO -- Uninstalling 20-20 Design 10.1.1.23 --
MsiExec.exe /X{A66E0B8B-0110-4F5B-92A6-F605E845D874}
:Uninstall_10.2.0.37
ECHO -- Uninstalling 20-20 Design 10.2.0.37 --
MsiExec.exe /X{C9134328-87B4-4A5A-805F-6D79EB721A6C}
:Uninstall_10.3.0.31
ECHO -- Uninstalling 20-20 Design 10.3.0.31 --
MsiExec.exe /X{0647EB56-58CA-46C2-8E05-4884CF34EB35}
:2020INSTALL
ECHO -- Installing 20-20 Design 10.4.0.39 --
:CheckSentinelVersion
if exist "C:\Program Files\Common Files\SafeNet Sentinel\Sentinel System Driver\SetupSysDriver.exe.exe" GOTO SentinelDriverCHECKVERSION
GOTO SentinelDriverINSTALL
:SentinelDriverCHECKVERSION
set SentinelCURRENTVERSION=7.5.0.1
FOR /F "tokens=2 delims==" %%G IN ('WMIC DATAFILE WHERE NAME^="C:\\Program Files\\Common Files\\SafeNet Sentinel\\Sentinel System Driver\\SetupSysDriver.exe.exe" get version /format:value') DO SET SentinelVERSION=%%G
IF %SentinelVERSION%==%SentinelCURRENTVERSION% (GOTO Install2020CurrentVersion)
:SentinelDriverINSTALL
"%~dp0\Perequesites\Sentinel Protection Installer 7.5.0.exe" /S /v /qn
PING 127.0.0.1 -n 30
:Install2020CurrentVersion
"%~dp0Setup.exe" /exelang 1033 /qb /norestart
PING 127.0.0.1 -n 60
ECHO -- Opening 20-20 Design 10.4.0.39 For First Time Use --
CD "C:\Program Files (x86)\20-20 Technologies\Design\Bin\System"
Design.exe
ECHO -- Waiting for Application to Close --
PING 127.0.0.1 -n 30
"%~dp0install sensio catalog-v10 english.exe"
:CHECKFOLDERREDIRECTION
FOR /F "skip=2 tokens=2,*" %%A IN ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "DESKTOP"') DO set "path=%%B"
if "%path%" == "%USERPROFILE%\Desktop" (goto Complete) else (goto REGIMPORT)
:REGIMPORT
REM IMPORT REGISTRY KEY DEFAULT SAVE LOCATION
REG IMPORT "%~dp020-20Pref.reg
:Complete
Echo You are Running the Latest Version of 20-20 10.4.0.39
:END
ECHO -- 20-20 Design 10.4.0.39 Has Been Successfully Installed --
PauseThe Error I receive is: Look at the IF Statement or even if I echo it keeps stripping off %2 (first 2 characters)