@echo off
REM Created by MVP v2.0.8.8
REM Please replace DriverProvider, DriverCategory, DriverItemType variables with exact names
title Installing Killer LAN_M E2600
if not exist %~d0\OEM\AcerLogs md %~d0\OEM\AcerLogs
SET LogPath=%~d0\OEM\AcerLogs\DriverInstallation.log
ECHO.>>%LogPath%
ECHO Installing, please wait...
SETLOCAL ENABLEDELAYEDEXPANSION
pushd "%~dp0"

ECHO %DATE% %TIME%[Log START]  ============ %~dpnx0 ============ >> %LogPath%


SET OSEnv=Online
if /i "%SystemDrive%" neq "%~d0" (
	ECHO !DATE! !TIME![Log TRACE]  Running in the WinPE or Offline, SET OSEnv=Offline >>%LogPath%
	SET OSEnv=Offline
)

if exist %~d0\OEM\Preload\Command\POP*.ini ECHO [Killer LAN_M E2600]>> %~d0\OEM\Preload\OEMINFLIST.ini
for /f "tokens=*" %%v in (InfFiles.txt) do (
	if /i "%OSEnv%" equ "Offline" (
		ECHO !DATE! !TIME![Log TRACE]  DISM /image:%~d0\ /add-driver /driver:"%%v" >> %LogPath%
		DISM /image:%~d0\ /add-driver /driver:"%%v" >> %LogPath% 2>&1  		
    ) else (
		ECHO !DATE! !TIME![Log TRACE]  pnputil /add-driver "%%v" /install >> %LogPath%
		pnputil /add-driver "%%v" /install >> %LogPath% 2>&1
		ECHO !DATE! !TIME![Log TRACE]  pnputil -i -a "%%v" >> %LogPath%
		pnputil -i -a "%%v" >> %LogPath% 2>&1
	)
    ECHO.>>%LogPath%

    for /f "skip=1 tokens=2 delims=,;" %%s in ('find /i "DriverVer" "%%v"') do (
        if exist %~d0\OEM\Preload\Command\POP*.ini ECHO %%~nxv=%%s>> %~d0\OEM\Preload\OEMINFLIST.ini
    )
)
if exist %~d0\OEM\Preload\Command\POP*.ini ECHO.>> %~d0\OEM\Preload\OEMINFLIST.ini

ECHO %DATE% %TIME%[Log Leave]  ============ %~dpnx0 ============ >> %LogPath%
ECHO.>>%LogPath%

popd
SETLOCAL DISABLEDELAYEDEXPANSION
ECHO Install finished
