@echo off SET configfolder=%1%@mysslvpndnsname.domain.com ::If it's installed, configure if exist "%programfiles%\Sophos\Sophos SSL VPN Client\Uninstall.exe" GOTO configure if exist "%programfiles(x86)%\Sophos\Sophos SSL VPN Client\Uninstall.exe" GOTO configure ::If there is no config file to be copied, exit if not exist "%cd%\configs\%configfolder%" GOTO end_noconfig ::Install the generic client START /WAIT setup.exe :configure if exist "%programfiles%\Sophos\Sophos SSL VPN Client\config\%configfolder%" GOTO end_alreadyinstalled if exist "%programfiles(x86)%\Sophos\Sophos SSL VPN Client\config\%configfolder%" GOTO end_alreadyinstalled if exist "%programfiles%\Sophos\Sophos SSL VPN Client\config" GOTO x64 if exist "%programfiles(x86)%\Sophos\Sophos SSL VPN Client\config" GOTO x86 :x64 xcopy "%cd%\configs\%configfolder%\*.*" "%programfiles%\Sophos\Sophos SSL VPN Client\config\%configfolder%\" /E goto end_success :x86 xcopy "%cd%\configs\%configfolder%\*.*" "%programfiles(x86)%\Sophos\Sophos SSL VPN Client\config\%configfolder%\" /E goto end_success :end_noconfig exit 0 :end_alreadyinstalled echo Already installed exit 0 :end_success echo VPN installed correctly exit 1