Skip to content

Instantly share code, notes, and snippets.

@xee5ch
Created June 12, 2011 13:34
Show Gist options
  • Save xee5ch/1021553 to your computer and use it in GitHub Desktop.
Save xee5ch/1021553 to your computer and use it in GitHub Desktop.
Recursively Check Folders for INF Files and Install Windows 7 PnP Drivers When Found
@ECHO OFF
IF "%1" == "" GOTO ERROR
ECHO.
ECHO Checking dir %1 recursively for drivers.
ECHO.
FOR /F "tokens=*" %%D IN ('DIR /B /AD /S %1') DO PNPUTIL -a "%%D\*.inf" 2>&1 >> %WinDir%\system32\driverimport.log
GOTO EOF
:ERROR
ECHO Missing argument! Must include QUOTED directory path!
ECHO %0 "C:\path\to\driver\folder\"
:EOF
@otanim
Copy link

otanim commented Jul 22, 2016

@xee5ch I've found this by searching in Google.
Thanks man !

@denree
Copy link

denree commented Aug 30, 2016

Note for those less familiar with DOS batch language: %1 refers to the first argument, meaning this script expects the parent path to be an argument to the script call. I just had to explain that to someone who wasn't up on batch files, so maybe this will save someone frustration some day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment