Driver Installer using DPinst Tool and Batch Script - KBA230662

Version 2

    Version: **

     

    Translation - Japanese: DPinst ツールおよびバッチスクリプトを使用したドライバーイントーラー - KBA230662 - Community Translated (JA)

     

    Question: How can I make a driver installer for a Cypress Driver package?

     

    Answer:

     

    You can use the Dpinst.exe tool and a batch script file to install the required driver on the PC from a package containing drivers for different OS version and architecture.

     

    The DPinst (Driver Package Installer) tool is a component of the DIFx (Driver Installer Frameworks) merge module. This tool identifies the driver present and the folder where it is located, authenticates the driver, and installs it.

    Every driver folder in the driver package should contain DPinst.exe along with the other driver files (.inf, .sys, .cat, and so on).

     

    The Batch script is used to locate the proper driver folder in the package that corresponds to the OS version and architecture running on the PC, and to execute dpinst.exe in the respective folder.

     

    An example driver package attached with this knowledge base article contains dpinst.exe in every driver folder along with the driver files, and a batch script file (dpInstScript.bat) to install the cyusb3 driver version 1.2.3.20. The dpInstScript.bat file can be altered depending on the structure of the driver package.

     

     

    Altering the Batch Script File:

     

    1. The batch script includes two variables, OSARCH and OSName, used to retrieve the path of the driver to be installed, corresponding to the Windows OS version and architecture running on the PC.

     

    • OSARCH - This variable contains the architecture (x64 or x86) of the OS running on the system. You can modify the value assigned to OSARCH, as required.

     

    if %errorlevel%==0 (

      set OSARCH=x64

    ) else (

      set OSARCH=x86

    )

     

    • OSName: This variable contains the name of the OS corresponding to the OS version running on the PC.

    Note: You can use the VER command to retrieve the version of Windows OS running on the PC.

     

    if "%IsClientOS%" == "true" (

    if "%OSVERSION%" == "5.1" set OSName=wxp

    if "%OSVERSION%" == "5.2" set OSName=wxp

    if "%OSVERSION%" == "6.0" set OSName=vista

    if "%OSVERSION%" == "6.1" set OSName=win7

    if "%OSVERSION%" == "6.2" set OSName=win8

    if "%OSVERSION%" == "6.3" set OSName=Win8.1

    if "%OSVERSION%" == "10.0" set OSName=Win10

    )

     

    You can remove entries corresponding to the drivers that are not supported and add entries for new OS releases.

     

    2. The productionFolderPath variable contains the path to the folder which has the driver to be installed. You can change the path according to the structure of the driver folders in the package.

     

    set productionFolderPath=%workingDir%\Drivers\%OSName%\%OSARCH%

     

    workingDir corresponds to the directory in which the batch file is present.

     

    In the attached driver package, the drivers are initially sorted in directories based on the Windows OS version names (OSName). Each directory contains the drivers for 32-bit and 64-bit architecture of the corresponding OS.

    The drivers are segregated based on their architecture, 32-bit or 64-bit (OSARCH).

    Installing the Driver:

     

    1. Execute the batch script to install the require driver from the driver package.

    Once the batch file is executed, the batch script locates the driver folder corresponding to the OS version and architecture running on the PC, and the dpinst.exe tool in that folder is executed.

     

    2. The Device Driver Installation Wizard appears. Click Next to start the driver installation.

     

    3. After the drivers are successfully installed PC, a success message is displayed. Click Finish to complete the driver installation process.

     

    You can use a dpinst.xml element along with dpinst.exe and driver files to customize the driver installation.

     

    Dpinst XML Element:

    https://docs.microsoft.com/en-us/windows-hardware/drivers/install/dpinst-xml-element