Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase

How to Launch INF Files from Winbatch

Keywords:   INF Files


I am trying to write a WinBatch script that will install Win 95 DUN scripting tool. The problem is that the install is in a file named rnaplus.inf which a user would right-click on and select Install. Does anyone know of a way to launch an inf file from the command line? My fallback is to use keystrokes to launch Control Panel, Add Remove and point to the rnaplus.inf file.


The following seems to work with INF files:
   InfFile = "c:\path\whatever.inf"
   Run("C:\WINDOWS\rundll.exe", "setupx.dll,InstallHinfSection DefaultInstall 132 %InfFile%")

   ;Or on Win NT and XP
   InfFile = "c:\path\whatever.inf"
   Run("C:\WINDOWS\rundll.exe","setupapi,InstallHinfSection DefaultInstall 132 %InfFile%")
You can determine the necessary commandline by looking under .inf in @REGCLASSES, which points to:
@REGCLASSES, Inffile\shell\Install\command[Default]

Installing network components without the Control Panel using INF Files (article from MS)


In order to install network components (for example, network adapters, network protocols or network services), you must use the Protocols, Services, or Adapters tab in Control Panel and then click Add to install the proper network component.

This article is aimed at providing a way to install any network component from a batch file, assuming you know the INF file name and the option. This information can be applied to install network components that are shipped with Windows NT, or to install any third-party component as soon as an Oemsetup.inf file is provided.

WARNING: The solution provided in this article doesn't compute the bindings. Therefore, if the bindings need to be done after the installation of a network component, the user will have run the Network Control Panel tool manually.


CAUTION: The solution included in this article has not been extensively tested in large installations. Microsoft cannot guarantee that modification of network components as recommended herein will accomplish the objective described in this article under all circumstances and in all configurations.

The Network Control Panel tool (loaded from a file called Ncpa.cpl) takes control over all setup of network components. When you add a network component through the interface, Ncpa.cpl tells Setup.exe to call Ncpashel.inf with specific parameters.

Instead of using the Network Control Panel tool, it is possible to call Setup.exe with the following parameters:

SETUP.EXE /f /i%systemroot%\system32\ncpashel.inf

          /T NTN_InstallMode = Install
          /T NTN_Origination = install
          /T NTN_Infname = OEMSETUP.INF
          /T NTN_SRCPATH = D:\I386
          /T NTN_Infoption = OPTION 

The command line above must be entered as a single line. Here is a description of all the parameters:
/f                 = Turns off blue background
/T NTN_InstallMode = Install, Remove, Update, Configure or Bind
                     This option is identical to the GUI interface
/T NTN_Origination = Install (= NCPA when setup issued by NCPA.CPL)
/T NTN_Infname     = Name of the INF file name
/T NTN_SRCPATH     = Path to the distribution files
/T NTN_Infoption   = Name of the option. To figure out which option has
                     to be installed, open the INF file and search for the
                     section [Options].  You should find the name of the
                     option to setup. 

For example, you may install Microsoft TCP/IP Printing with a batch file including the following commands (it is assumed below that D: is your CD- ROM drive):
cd %systemroot%
setup /f /i%systemroot%\system32\ncpashel.inf

      /T NTN_InstallMode = Install
      /T NTN_Origination = install /T NTN_Infname = .\OEMNSVTP.INF
      /T NTN_SRCPATH = D:\I386
      /T NTN_InfOption = TCPPRINT 

Oemnsvtp.inf is the INF file that directs installation of the Microsoft TCP/IP Printing component. It contains the following section:

Article ID:   W13269
Filename:   Launch INF Files.txt