Installing CAB File After Exctraction RRS feed

  • Question

  • I have written a small batch file to create a folder called drivers, copy the cab file to the folder, extract the cab file into the same folder destination, and then run a command to install all inf files from the 64 bit folder.  The issue i am having is when i try to run the command to install the inf files, it tells me the that 'The system cannot find the file 'dir".  The following is my code.  I tried using pkgmgr.exe, but that fails with a error as well that is not relevant.

    When i try to open cmd and change the directory after the cab file has been extracted, i then try running the pnputil.exe command, and it still fails with the same error.

    if not exist "C:\Drivers" mkdir C:\Drivers

    xcopy "Y:\Deployment Programs\Optiplex 9020 Drivers\9020-win7-A10-7NT4C.CAB" "C:\Drivers"


    Expand –F:* C:\Drivers\9020-win7-A10-7NT4C.CAB C:\Drivers

    cd C:\Drivers\9020\win7\x64

    for /f %i in (‘dir /b /s *.inf’) do pnputil.exe -i -a %i


    Thursday, March 10, 2016 4:17 PM


  • I found out that "for /f %i in (‘dir /b /s *.inf’) do pnputil.exe -i -a %i" needs to run under the C:\Drivers\9020 folder, and not the C:\Drivers\9020\win7\x64 folder.  Works fine now, just need to find an easy way to run it in admin.
    • Marked as answer by fusioncha0s Thursday, March 10, 2016 4:54 PM
    Thursday, March 10, 2016 4:31 PM