How to Automate .inf PnP Windows 7 Drivers with Wildcard?

Posted by Dos_Probie on Super User See other posts from Super User or by Dos_Probie
Published on 2012-10-09T01:44:37Z Indexed on 2012/10/09 3:40 UTC
Read the original article Hit count: 452

Filed under:
|
|

I am trying to automate the PnP driver installs for Windows 7 with either of the below batch files via For loop and wildcard for the .inf file.

The rundll32 batch reads and echos the correct .inf file but then gives me the "Error Installation failed" and with the pnputil batch it runs without any error put does not install.

How can I correct the batch files to install the inf correctly?

@echo off&color a&setlocal enabledelayedexpansion
cd %~dp0

set PnP=rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\*.inf
for /f "delims=" %%a in ('dir/b %PnP%') do (
echo == Installing PnP Drivers == "%%a"
::or
set PnP=pnputil -i -a "*.inf"
for /f "delims=" %%a in ('dir/b %PnP%') do (
echo == Installing PnP Drivers == "%%a"

ping -n 3 localhost 1>nul
start "" /wait %PnP%\%%a
)
cls
echo. * DONE *
pause
exit

© Super User or respective owner

Related posts about windows-7

Related posts about Windows