INF files installing from cmd prompt or shortcut.

T

Tim_S

I am looking for the proper way to "install" the contents of an .inf file by
using a shortcut or command prompt.

For instance, I have a security.inf file that when you right click on the
file, in the context menu there is an Install option. When i click on the
Install option the .inf file installs itself to the registry.

I want to perform the same function using a shortcut or at the command
prompt.

Thanks.
 
R

Ray at

%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection
DefaultInstall 132 %1

That's the commad on an XP computer. (The %1 is the variable for the path
to the .inf file that you're right clicking on.)

To find out the action that is taken from the contenxt menu for a file
extension, navigave to HKCR\.EXT. Get the default value for that extension
to see what is set to handle that extension. In this case, it is "inffile."
So, then you navigate to HKCR\inffile. Then expand to \shell and you'll see
the context options specific to that file type there.

Ray at home

p.s. HKCR = HKLM\Software\Classes
 
T

Tim_S

Thanks Ray for the fast response post.
That is what I first thought, but for some reason when I created a shortcut
(or type in command prompt window) with the following path it does not work.
"rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 security.inf"
(quotes added)

I will try again tommorrow and if I can't get it to work, I will post the
..inf file. (I don't have it with me at the moment)
 
R

Ray at

Does it work when you right click the inf file and choose the install
command? Also, does your shortcut "start in" the path to that .inf file?
If not, pass the full path to the inf file.

Ray at home
 
M

Matthias Tacke

at <%=sLocation%>" <myfirstname at lane 34 . komm> wrote:

To find out the action that is taken from the contenxt menu for a file
extension, navigave to HKCR\.EXT. Get the default value for that
extension to see what is set to handle that extension. In this case,
it is "inffile." So, then you navigate to HKCR\inffile. Then expand
to \shell and you'll see the context options specific to that file
type there.
Ray at home
Hello Ray,
using assoc and ftype you can do that also from the command line and
automate this to a certain degree.
 
M

Matthias Tacke

Matthias Tacke said:
Hello Ray,
using assoc and ftype you can do that also from the command line and
automate this to a certain degree.
Here a small proof of concept.

::exttype.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off & setlocal ENABLEEXTENSIONS
If [%1] EQU [] goto :USAGE
Set Asso=%1
if [%Asso:~0,1%] NEQ [.] goto :USAGE
for /F "tokens=1-2,* delims==" %%A in ('assoc %1^|find "%1="') do (
Set Ftyp=%%B
for /F "tokens=1-3,* delims==" %%D in ('ftype %%B') do call :SPLIT %%E
)
echo/%Asso% assoc %Ftyp%
echo/ ftype %Ftyp% -^> %Prog% %Para%
goto :EOF
:SPLIT
set Prog=%~1
set Para=%~2
goto :EOF
:USAGE
echo/Uasage: %0 .ext
echo/Enter extension with a leading dot
::exttype.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
T

Tim_S

Thanks for the tips, The original method "rundll32" worked just fine... I
must have mistyped something the first time...

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top