@echo off
rd "%WinDir%\system32\test_permissions" >NUL 2>NUL
md "%WinDir%\System32\test_permissions" 2>NUL
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Request admin rights...
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B

:gotAdmin
rd "%WinDir%\System32\test_permissions" 2>NUL

cd /d %~dp0
call uninstall.bat /b
ver | findstr /r /i "5.1.*]" > NUL && goto WinXP
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto x64
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" goto x64
if "%PROCESSOR_ARCHITECTURE%"=="x86" goto x86

:x86
drv\devcon_x86 install drv\rfdisk\win7\rfdisk.inf root\rfdisk
rfdk -i 
goto NEXT

:x64
drv\devcon_x64 install drv\rfdisk\win7\rfdisk.inf root\rfdisk
rfdk64 -i 
goto NEXT

:WinXP
drv\devcon_x86 install drv\rfdisk\winxp\rfdisk.inf root\rfdisk
rfdk -i 
goto NEXT

:NEXT
sc failure rfdk reset= 0 actions= restart >NUL
sc start rfdk >NUL
pause

