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
net stop "Wing FTP Server"
TASKKILL /F /IM WFTPServer.exe

del "%ProgramFiles(x86)%\Wing FTP Server\license.dat"
del "%ProgramFiles(x86)%\Wing FTP Server\WFTPServer.exe"
Copy "%~dp0Files\WFTPServer.exe" "%ProgramFiles(x86)%\Wing FTP Server\WFTPServer.exe"
Copy "%~dp0Files\license.dat" "%ProgramFiles(x86)%\Wing FTP Server\license.dat"
net start "Wing FTP Server"
pause
EXIT