@echo off
set "Apply=%*"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query "%systemdrive%" 1>nul 2>nul || (  cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && ""%~0"" %Apply%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" /f && exit /b )
color 9
chcp | find "936">nul && set LCN=TURE||set LEN=TURE
set Lan=EN
if defined LCN (
	set Lan=CN
        goto CN
)

title Auto Install Drivers
echo *************************************************************************
echo Installing the driver, please be patient...
echo *************************************************************************
goto setup

:CN
title 自动安装驱动脚本
echo *************************************************************************
echo 正在安装驱动，请耐心等待。。。。
echo *************************************************************************

:setup
setlocal EnableExtensions EnableDelayedExpansion
for /f "delims=" %%b in ('dir /s /b ".\*.inf"') do (
	set INF_NAME=%%~nb
	set INF_PATH=%%~dpb
	cd /d !INF_PATH!
	pnputil -i -a !INF_NAME!.inf
)
timeout /t 3
exit