NET SESSION
IF %ERRORLEVEL% NEQ 0 GOTO ELEVATE
GOTO ADMINTASKS

:ELEVATE
CD /d %~dp0
powershell -Command "Start-Process %~nx0 -Verb RunAs"
rem MSHTA "javascript: var shell = new ActiveXObject('shell.application'); shell.ShellExecute('%~nx0', '', '', 'runas', 1);close();"
EXIT

:ADMINTASKS
TASKKILL /F /IM CerberusGUI.exe
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)


:64BIT
del "%ProgramW6432%\Cerberus LLC\Cerberus FTP Server\CerberusGUI.exe"
Copy "%~dp0Files\x64\CerberusGUI.exe" "%ProgramW6432%\Cerberus LLC\Cerberus FTP Server\CerberusGUI.exe"
GOTO END

:32BIT

del "%ProgramFiles%\Cerberus LLC\Cerberus FTP Server\CerberusGUI.exe"
Copy "%~dp0Files\x32\CerberusGUI.exe" "%ProgramFiles%\Cerberus LLC\Cerberus FTP Server\CerberusGUI.exe"
GOTO END

:END
pause
EXIT