@Echo off
 REM Written by Jeff Herre AKA OverFlow rev08.12.1
 REM A Script to use MicroSofts DPInst.exe with the DriverPacks.
 REM Help and Support available at http://forum.DriverPacks.net  
TITLE DriverPacks.net Stand Alone Driver Updater & Color 9f

Set LOG=nul & IF [%1] NEQ [] (IF /I [%1] NEQ [Q] (Set LOG=%1) & IF /I [%1] EQU [V] (Set LOG=CON))

  Echo. & Echo Locating the DriverPacks...
Set "M=0" & Set "cur=%~dp0" 
If [%cur:~-1%]==[\]             Set "cur=%cur:~0,-1%"
IF Exist "%cur%\D\"             Set "DPLoc=%cur%" & Set "M=1" & GoTo Found
IF Exist "%cur%\bin\un7zip.exe" Set "DPLoc=%cur%" & Set "M=2" & GoTo Found
  Echo Searching Root folders since DriverPacks were not found in current folder...
FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y) DO (
 IF Exist "%%i:\OEM\bin\un7zip.exe" SET "DPLoc=%%i:\OEM" & Set "M=2"
 IF Exist "%%i:\$OEM$\$1\D\"   SET "DPLoc=%%i:\$OEM$\$1" & Set "M=1" & %%i
 IF "%M%">="1" GoTo Found)
  Echo. & Echo Strange... The DriverPacks were not found ??? :( & Echo. & Pause & GoTo Done


:Found
Set DPFL=%SystemDrive%\DPsFnshr.ini
IF "%M%"=="1" (
  Echo. & Echo Prepareing the DriverPacks Finisher. Method 1 was found. & Echo.
 IF NOT "%DPLoc%"==%SystemDrive% Echo Copying Driverpacks Finisher files & COPY "%DPLoc%\." %SystemDrive%\ >>%LOG
 Echo [Settings]			 	>  %DPFL%
 Echo DPsRoot     = "%DPLoc%"			>> %DPFL%
 Echo DPsRootDel  = "false"			>> %DPFL%
 Echo debug       = "true"			>> %DPFL%
 CD %DPLoc%\D
)
IF "%M%"=="2" (
  Echo. & Echo Prepareing the DriverPacks now. Method 2 was found. & Echo.
 Start /wait /separate /high "" "%DPLoc%\bin\un7zip.exe" "%DPLoc%\DP*.7z" %SystemDrive%\
 COPY /Y "%DPLoc%\DPInst.*" 			%SystemDrive%\D\ >>%LOG%
 COPY /Y "%DPLoc%\*.ins" 			%SystemDrive%\   >>%LOG%
 "%DPLoc%\bin\un7zip.exe" "%DPLoc%\bin\*.7z" 	%SystemDrive%\
 Echo [Settings]			 	>  %DPFL%
 Echo DPsRoot     = "%SystemDrive%"		>> %DPFL%
 Echo DPsRootDel  = "true"			>> %DPFL%
 Echo debug       = "true"			>> %DPFL%
 %SystemDrive% & cd %SystemDrive%\D
)
Echo KTD         = "false"			>> %DPFL%
Echo KTDlocation = "%SystemRoot%\DriverPacks"	>> %DPFL%
Echo logLocation = "%SystemRoot%"		>> %DPFL%


  Echo. & Echo. & Echo Running the MicroSoft Driver Pack Installer now !
  Echo The progress window is minimized to the task bar & Echo. & Echo.
Start "MicroSoft Driver Pack Installer Tool Running" /wait /separate /realtime /min CMD /C DPInst.exe /c /s


  Echo. & Echo Running the DriverPacks.net Finisher now! & Echo.
%SystemDrive% & cd\ & Start /wait /separate /high "" DPsFnshr.exe


 REM Log and Attended output section
IF /I [%1] NEQ [Q] (

 IF [LOG] NEQ [nul] (
  Echo. & Echo Method%M% was found at: >>%LOG%
  Echo %DPLoc% >>%LOG%
  Echo List INF's that were matched with this system  >>%LOG%
  FOR /F "usebackq tokens=2,3*" %%G IN ('type F:\WINDOWS\DPINST.log') DO (
   If [%%G]==[Successfull] IF [%%H]==[installation] Echo %%G %%H %%I >>%LOG%)
 )
 Echo.  & Echo The DriverPacks Stand Alone Drivers installation is complete!
 Echo  & Start /min sndrec32 /play /close %windir%\media\ding.wav
 Echo.  & Echo This window will close itself in 30 seconds... & Echo. 
 For /l %%A in (1,1,30) do (<nul (set/p z=#) & >nul ping 127.0.0.1 -n 2 )  
)

:Done
EXIT