@set L=C:\Windows\temp\install.log
@set IP=[********Install Pass********]
@set IPR=[********Install Pass, Restart is need********]
@set IF=[********Install Fail********]

@echo [%time%]=========Install Realtek Audio driver========= >> %L%

:ins1
@echo [%time%]1.ExtRtk_8943.inf >> %L%
pnputil /add-driver "%~dp0Drivers\ExtRtk_8943\HDX_WhiteExt_RTK.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto ins2)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto ins2)
@if not %errorlevel%==0 goto ERR

:ins2
timeout /t 5 /nobreak
@echo [%time%]2.Codec_8943.inf >> %L%
pnputil /add-driver "%~dp0Drivers\Codec_8943\HDXWHITE.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto ins3)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto ins3)
@if not %errorlevel%==0 goto ERR

:ins3
timeout /t 60 /nobreak
@echo [%time%]3.RealtekAPO.inf  >> %L%
pnputil /add-driver "%~dp0Drivers\RealtekAPO_773\*.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto ins4)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto ins4)
@if not %errorlevel%==0 goto ERR

:ins4
@echo [%time%]4.RealtekHSA.inf  >> %L%
pnputil /add-driver "%~dp0Drivers\RealtekHSA_217\*.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto ins5)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto ins5)
@if not %errorlevel%==0 goto ERR

:ins5
@echo [%time%]4.RealtekASIO_5.inf  >> %L%
pnputil /add-driver "%~dp0Drivers\RealtekASIO_5\*.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto ins6)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto ins6)
@if not %errorlevel%==0 goto ERR

:ins6
@echo [%time%]RealtekService_255  >> %L%
pnputil /add-driver "%~dp0Drivers\RealtekService_255\*.inf" /install >> %L%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & goto resultpass)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & goto resultpass)
@if not %errorlevel%==0 goto ERR

:resultpass
@echo [%time%]=========Realtek Audio driver Install Complete========= >> %L%
ECHO ERRRORLEVEL=%ERRORLEVEL% >> %L%
@set LL=C:\Windows\temp\Audio.log
@echo [%time%] >>%LL%
EXIT /B 0

:ERR
echo [%time%]%IF% >> %L%
ECHO ERRRORLEVEL=%ERRORLEVEL% >> %L%
EXIT /B 1