
@echo off
chcp 65001 >nul 2>&1

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else (
    goto gotAdmin
)

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

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

#PPM驱动安装
    echo Installing drivers from PPM directory...
Start /w pnputil.exe /add-driver "%~dp0\*.inf" /subdirs /install
    if %errorlevel% equ 0 (
        echo PPM drivers installed successfully!
    ) else (
        echo Warning: PPM drivers installation may have failed!
    )
    echo.


    echo Driver installation process completed.
    PAUSE
    exit /B