Reputation: 43
I have a directory which contains hundreds of other child directories, which all contain various INF files which I've extracted from a .CAB file.
I want to create a batch file that finds every single inf file in this directory and install it.
Code so far:
for /f %f in ('dir /s /b c:\temp_dir\*.inf') do rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %f
In return, I get a critical message box appear hundreds of times saying "Installation failed". Please can someone point out my mistake because I'm completely stumped.
Environment: Windows 7 x64
Thanks in advance!
Upvotes: 0
Views: 5417
Reputation: 41224
Use %%f
in a batch file. You use %f
at the cmd prompt, with a for loop.
Additionally, if the current directory is not c:\temp_dir
then it needs to be added to the final term.
@echo off
for /f "delims=" %%f in ('dir /s /b "c:\temp_dir\*.inf" ') do rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 "c:\temp_dir\%%f"
EDITED: Different method to make the directory current and with "delims="
added (above too)
@echo off
cd /d "c:\temp_dir\"
for /f "delims=" %%f in ('dir /s /b *.inf ') do rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 "%%f"
Upvotes: 0