@echo Please wait while installing drivers. Do not turn off or unplug the computer power during the installation...
@echo off

%~d0
cd %~dp0

if %errorlevel% NEQ 0 GOTO :ERRORELEVATION

pushd %~dp0


reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /f /v "Path" /d "c:\windows\system32\windowspowershell\v1.0\powershell.exe"
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /f /v "ExecutionPolicy" /d "unrestricted"

@ping 127.0.0.1 -n 10 -w 1000 > nul
powershell .\PIN.ps1

@ping 127.0.0.1 -n 5 -w 1000 > nul

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /f /v "Path" /d "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /f /v ExecutionPolicy

Goto :end

:ERRORELEVATION
echo.
color 0c
echo ERROR, script has not been run elevated.
echo Right click script and choose Run as Administrator or run from elevated command prompt
echo.
pause
color

:end


:end

@ping 127.0.0.1 -n 2 -w 1000 > nul
EXIT