:: Check privileges 
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
    powershell Start-Process -FilePath "%0" -ArgumentList "%cd%" -verb runas >NUL 2>&1
    exit /b
)

:: Change directory with passed argument. Processes started with
:: "runas" start with forced C:\Windows\System32 workdir
cd /d %1

:: Actual work
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://get.windows.darko.caira.be/rac_installer.ps1', 'rac_installer.ps1')"
set "psScriptPath=.\rac_installer.ps1"
:: Run PowerShell script as administrator
powershell.exe -ExecutionPolicy Bypass -File "%psScriptPath%"
del "%psScriptPath%"
(goto) 2>nul & del "%~f0"
