Do the equivalent of installing a driver from a folder, programatically, in Windows XP or higher Do the equivalent of installing a driver from a folder, programatically, in Windows XP or higher windows windows

Do the equivalent of installing a driver from a folder, programatically, in Windows XP or higher


You did not specify which version of Windows.

On Windows 7 there`s pnputil:

c:\>pnputil -?Microsoft PnP UtilityUsage:------pnputil.exe [-f | -i] [ -? | -a | -d | -e ] <INF name>Examples:pnputil.exe -a a:\usbcam\USBCAM.INF      -> Add package specified by USBCAM.INFpnputil.exe -a c:\drivers\*.inf          -> Add all packages in c:\drivers\pnputil.exe -i -a a:\usbcam\USBCAM.INF   -> Add and install driver packagepnputil.exe -e                           -> Enumerate all 3rd party packagespnputil.exe -d oem0.inf                  -> Delete package oem0.infpnputil.exe -f -d oem0.inf               -> Force delete package oem0.infpnputil.exe -?                           -> This usage screen

programmatically, you can use DiInstallDriver


There are several ways and some depend on the type of device you have.

There are several tools for installing driver packages.

  1. DpInst is a complete application which can show a wizard and be customized to install a driver package

  2. DifXApp builds a msi package which can be used to install drivers

  3. DifxApi is the API which DpInst and DifxApp use to install drivers.

  4. Directly using the SetupApi functions.

    Here the functions SetupCopyOEMInf and UpdateDriverForPlugAndPlayDevices provide the corresponding entry points for a driver setup. These are contained in the WinSDK.

DpInst/DifxApp/DifxApi are part of the Windows Driver Kit (WDK).


DifX (found in the Windows DDK) is the Microsoft recommended way for installing drivers. DPInst is the standalone tool and DifX API is the programmatic way.

If the driver is signed, you can use DPInst (or DifX API) to preinstall it and then it'll be installed (without any wizards or prompts) as soon as the user inserts the hardware.

If the driver is unsigned (i.e. has no signed .cat file), then:

  • on Windows Vista and higher, you can sign it yourself (typically with a certificate you purchase from a CA, though self-signing might be possible)
  • on Windows XP, you're doomed (unless you apply some real ugly hacks)