@echo off
call check-for-admin
if %ERRORLEVEL% neq 0 exit /b

set OPT=..\optional
set SOFTWARE=..\software
set MSI=openvpn-setup.msi

set STARTMENU="%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs"

if NOT EXIST %SOFTWARE%\%MSI% (
  echo ERROR: %SOFTWARE%\%MSI% not found!
  exit /b
)

echo ####### %0 #######

echo installing OpenVPN ...
cd %SOFTWARE%
@echo on
msiexec /i %MSI% /q
@echo off
cd %OPT%

echo moving OpenVPN startmenu shortcut ...
move /Y %STARTMENU%\"OpenVPN\OpenVPN GUI.lnk" %STARTMENU%\OpenVPN.lnk

echo removing Inkscape startmenu folder ...
rd /S /Q %STARTMENU%\"OpenVPN" 2>nul

echo removing Desktop icon ...
del /F /Q "%PUBLIC%\Desktop\OpenVPN GUI.lnk" 2>nul

echo refreshing desktop (W10 style) ...
ie4uinit.exe -show

echo ####### %0 #######
pause

