.inf file will not run from the command line

  • Thread starter Michael A. Covington
  • Start date
M

Michael A. Covington

I have an .inf file that installs just fine when I right-click on it and
choose Install, but when I execute the command:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
LatexWithoutCommandPrompt.inf

I get "Installation failed." What's wrong?

For the curious, the whole file is reproduced below. Note that a few lines
may have wrapped.

Thanks in advance for anyone who can point out my errors!


---------------------------------cut here--------------------------------;
"LaTeX Without Command Prompt" (LaWCP) Utility
;
; Michael A. Covington - www.ai.uga.edu/mc - 2004
;
; This script makes it possible to run LaTeX and TeXify
; by right-clicking on the files.

; TO INSTALL:
; First make any necessary changes in the [Strings] section.
; Then right-click on the .inf file and choose Install.
;
; To install from the command line or in a .bat file:
; rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
LatexWithoutCommandPrompt.inf
;
; To uninstall, use Control Panel, Add/Remove Programs
; or use the same command but with "DefaultUninstall" instead of
"DefaultInstall".

[Version]
signature="$Windows NT$"


;; Definitions of strings used subsequently

[Strings]

EDITOR="c:\Program Files\pfe\pfe32.exe" ; editor with which to open TeX
files
BACKUP=".$$$" ; extension of editor backup
files

LATEX="c:\texmf\miktex\bin\latex.exe" ; locations of TeX programs...
TEXIFY="c:\texmf\miktex\bin\texify.exe"
DVIPS="c:\texmf\miktex\bin\dvips.exe"

NAME="LaTeX Without Command Prompt utility" ; name
to use for uninstall
UDHERE="Software\Microsoft\Windows\CurrentVersion\Uninstall\LaWCP" ; where
to keep the uninstall info
FILENAME="LatexWithoutCommandPrompt.inf" ; this
file


;; How to install and uninstall

[DefaultInstall]
CopyFiles = LaWCP.Files.Inf
AddReg = LaWCP.Reg

[DefaultUninstall]
DelFiles = LaWCP.Files.Inf
DelReg = LaWCP.Reg


;; How to copy the .inf file from its present location
;; to the windows INF folder (directory 17) so it will be available
;; at uninstall time

[DestinationDirs]
LaWCP.Files.Inf = 17

[LaWCP.Files.Inf]
%FILENAME%



;; Registry entries to be installed (and removed upon uninstallation).
;; Throughout, %11% is windows\system32, where cmd.exe resides.

[LaWCP.Reg]

;; Label editor backup files as such, and always show their extensions
HKCR,"%BACKUP%",,,"Editor Backup File"
HKCR,"%BACKUP%",AlwaysShowExt

;; Always show extensions of the following file types

HKCR,".aux",AlwaysShowExt
HKCR,".lof",AlwaysShowExt
HKCR,".log",AlwaysShowExt
HKCR,".lot",AlwaysShowExt
HKCR,".toc",AlwaysShowExt
HKCR,".ps", AlwaysShowExt
HKCR,psfile,AlwaysShowExt
HKCR,txtfile,AlwaysShowExt

;; Options for .tex and .ltx files

HKCR,".ltx",,,"LaTeX.Document"
HKCR,".ltx",AlwaysShowExt

HKCR,".tex",,,"LaTeX.Document"
HKCR,".tex",AlwaysShowExt

HKCR,LaTeX.Document\shell\open,,,"Open"
HKCR,LaTeX.Document\shell\open\command,,,"""%EDITOR%"" ""%1"""

HKCR,LaTeX.Document\shell\latex
HKCR,LaTeX.Document\shell\latex,,,"LaTeX"
HKCR,LaTeX.Document\shell\latex\command,,,"""%11%\cmd.exe"" /s /c ""color f0
&& ""%LATEX%"" ""%1"" && echo. && pause"""

HKCR,LaTeX.Document\shell\latextwice
HKCR,LaTeX.Document\shell\latextwice,,,"TeXify"
HKCR,LaTeX.Document\shell\latextwice\command,,,"""%11%\cmd.exe"" /s /c
""color f0 && ""%TEXIFY%"" ""%1"" && echo. && pause"""

;; Options for .dvi files

HKCR,".dvi",,,LaTeX.DVI
HKCR,".dvi",AlwaysShowExt

HKCR,LaTeX.DVI\shell\dvips
HKCR,LaTeX.DVI\shell\dvips,,,"DVIPS"
HKCR,LaTeX.DVI\shell\dvips\command,,,"""%11%\cmd.exe"" /s /c ""color 70 &&
""%DVIPS%"" ""%1"" && echo. && pause"""

;; Icons.
;; These are taken from Windows' stock set, so they are also used for other
purposes.

HKCR,LaTeX.Document\DefaultIcon,,,"""%11%\shell32.dll"",-151" ; page with
a gear on it
HKCR,LaTeX.DVI\DefaultIcon,,, """%11%\shell32.dll"",-153" ; window
with a gear in it

;; How to uninstall this package using Add/Remove Programs

HKLM,%UDHERE%,DisplayName,,"%NAME%"
HKLM,%UDHERE%,UninstallString,,"rundll32.exe setupapi,InstallHinfSection
DefaultUninstall 132 %17%\%FILENAME%"

;; END.
 
M

Michael A. Covington

Michael A. Covington said:
I have an .inf file that installs just fine when I right-click on it and
choose Install, but when I execute the command:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 LatexWithoutCommandPrompt.inf

I get "Installation failed." What's wrong?

Answering my own question, the command needs to be:

rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
..\LatexWithoutCommandPrompt.inf

For some reason the .\ is necessary to make it start in its own directory
under all circumstances.
 
J

Jim Cavalaris [MS]

yes, you must specify a path to the INF on the cmd line,
not just the file name.

hope this helps,
jim.

InstallHinfSection:
http://msdn.microsoft.com/library/en-us/setupapi/setup/installhinfsection.asp

To run an Install section of a specified .inf file, you can invoke
InstallHinfSection with the Rundll32.exe by using the following
syntax.

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection <section> <mode> <path>

This passes "<section> <mode> <path>" to CmdLineBuffer.

Alternatively, your program may call InstallHinfSection,
InstallHinfSectionA, or InstallHinfSectionW directly,
setting the CmdLineBuffer parameter to the following.

"<section> <mode> <path>"
Where path is the full path to the .inf file
 

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