问题
I would like to install my USB device driver [.inf file] using PnPUtil.exe utility on both 32bit and 64bit systems for Windows Vista and Windows 7.
I tested on my machine [Windows 7 32bit] and everything was fine because PnpUtil.exe is located in: C:\Windows\System32\PnPUtil.exe. But in 64bit Windows 7 the utility is not in this directory.
When I tried installing driver on different Windows 7 - 64bit machine I could found PnPUtil.exe in this location: C:\WIndows\winsxs\amd64_microsoft-windows-pnputil_31bf3856ad364e35_6.1.7600.16385_none_5958b438d6388d15\pnputil.exe and the test was also fine.
So how can I exactly detect this directory on all platforms? I noticed the path is dependent on built of Windows version - 6.1.7600.16385 - but how to detect the rest of path? Or is the path always the same on all 64 bit platforms? And what about Vista?
回答1:
I recently came across this problem while trying to create an installer for ReplicatorG, which includes the Arduino drivers and some drivers specific to the Makerbot Replicator.
It seemed that there isn't any way to determine the location of PnPutil, and I instead had to acquire Microsoft's DIFx and use their redistributable DPinst.
There were a couple of strange things about DPinst that made it difficult to use. The first is that it didn't seem to run properly if it was located in a directory tree with spaces in the path. Who knows why. The second was that, because the Arduino drivers are unsigned, it needed to be run in legacy mode to keep from popping up a big, red dialog warning the user. To run it in legacy mode you use the /lm
flag, but the flag must be lowercase. Again, it's unclear why.
In the end, I had the installer copy dpinst and each of the drivers to a folder in the temporary directory and then run dpinst. It pops up a nice little wizard and tells the user which drivers were installed.
回答2:
The location of PnPUtil.exe seen from you installer application depends on the bitness of your installer:
- 32bit installer on 32bit Windows: %WinDir%\System32
- 64bit installer on 64bit Windows: %WinDir%\System32
- 32bit installer on 64bit Windows: %WinDir%\Sysnative (Windows Vista and up)
More info here: http://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm
回答3:
From C:\WIndows\winsxs\
dir /s PnPUtil.*
will scan subdirectories
来源:https://stackoverflow.com/questions/8253713/what-is-pnputil-exe-location-in-64bit-systems