What is PnPUtil.exe location in 64bit systems? - windows-7

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?

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

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.

From C:\WIndows\winsxs\
dir /s PnPUtil.*
will scan subdirectories

Related

which file can install a program on windows 7?

Which of these files( in setup folder), if execute can install a program on windows 7 ?
1- setup.com
2-setup.ini
3-setup.inf
COM files are executable in Windows. You should be able to run setup.com from the CMD prompt by cding to the directory setup.com is in, and running setup or setup.com.
Keep in mind, COM files cannot be executed on 64-bit versions of Windows, since these editions lack NTVDM, the MS-DOS-emulating subsystem that handles COM file execution. You would instead need to emulate the 32-bit environment using an emulator like DOSBox.
setup.inf can be used to file copy and installation. I cannot remember setup.com installers for Windows programs.
msdn inf description

Emacs24.5 for Windows 64bit TLS support

I want use emacs24.5 on my windows10 64bit laptop and I want use https ,but when I download gnuutil32 from sourceforce and add all dlls into emacs installations bin directory .it does not work,somebody can tell me what's wrong?
I started to use emacs-24.3-bin-i386.zip, I had the same problem as you, I copied the gnuutil32 dlls into emacs's bin and it doesn't work.
So I think the dlls may work on mingw32, I download emacs-25.1-x86_64-w64-mingw32.zip, the mingw32 version, and the gnuutil32 dlls as well.
If you use 64bit emacs, you may find alternative 64bit dlls.

changing drivers through batch file

Is there a way to forcibly change drivers for particular devices in a batch file?
What my issue is here is that I'm trying to automate the process of selecting the correct driver for a projector that is connected to a computer and right now the projector is turned on automatically after the computer is started through a batch file.
However generic drivers are selected instead of the proper driver for that projector.
Is there a command I can use to forcibly change the driver for that projector or is there another way to change the default driver from the generic to the one I need automatically rather than manually?
In your batch file you need to find out:
Windows x86 (32 bit) or Windows x64 (64 bit) for example with:
if "%ProgramFiles(x86)%" == "" goto Driver32Bit
:Driver64Bit
echo Detected Windows x64
rem Commands for installing correct 64 bit driver after determining Windows version.
goto :EOF
:Driver32Bit
echo Detected Windows x86
rem Commands for installing correct 32 bit driver after determining Windows version.
goto :EOF
Windows version using command ver for selecting correct driver directory.
In each directory containing the driver files for appropriate Windows there should be dpinst32.exe or dpinst64.exe to install the driver. See Driver Package Installer (DPInst) for details about this free Microsoft application for installing drivers.
Very often the manufacturer of the driver delivers the driver packages already with dpinst32.exe and dpinst64.exe as often used by their own driver installers, too. Otherwise you need to download Windows Driver Kit and extract those two files from WDK package. Installing WDK is not necessary.

pnputil.exe is not recognized as an internal or external command [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
When i executed the command via command propmt to install the driver :
cd C:\Windows\System32
pnputil.exe -i -a "C:\Users\Desktop\Drivers\IPEnabled_001.inf"
It work fine.
But if i execute the command in Installanywhere tool
It showing the error message:
pnputil.exe is not recognized as an internal or external command
So could you please tell why it is showing the error message and how the reslove that error?
Thanks in advance.
Please also suggest the alternate way to install inf driver
pnputil.exe is on 64-bit Windows available only as 64-bit application which means there is %SystemRoot%\System32\pnputil.exe (x64) but no %SystemRoot%\SysWOW64\pnputil.exe (x86).
Which directory becomes current directory on using cd C:\Windows\System32 depends on 64-bit Windows on architecture of the application which started Windows command interpreter cmd.exe. A 64-bit application starts really %SystemRoot%\System32\cmd.exe, but a 32-bit application starts %SystemRoot%\SysWOW64\cmd.exe. The reason is the Windows File System Redirector which redirects any file access to %SystemRoot%\System32 to the directory %SystemRoot%\SysWOW64 on Windows x64 for x86 applications.
It is best to check for existence of this file before executing it for this task running pnputil.exe existing only in directory %SystemRoot%\System32 on any Windows independent on Windows architecture.
if exist %SystemRoot%\System32\pnputil.exe (
set "SystemPath=%SystemRoot%\System32"
) else if exist %SystemRoot%\Sysnative\pnputil.exe (
set "SystemPath=%SystemRoot%\Sysnative"
) else (
echo ERROR: Cannot find pnputil.exe to install the driver.
echo/
pause
goto :EOF
)
%SystemPath%\pnputil.exe -i -a "%USERPROFILE%\Desktop\Drivers\IPEnabled_001.inf"
The first IF condition is true for 32-bit applications on 32-bit Windows and 64-bit applications on 64-bit Windows.
The second IF condition is true for 32-bit applications on 64-bit Windows. Sysnative is a special redirector for x86 applications on Windows x64. Sysnative does not exist for x64 applications. Sysnative is not a directory or a symbolic link or a hard link. So it is not possible to use if exist %SystemRoot%\Sysnative as this condition is never true. It is required to check if a file exists in the redirected directory, for example with if exist %SystemRoot%\Sysnative\* which is only true on running currently 32-bit cmd.exe on 64-bit Windows.
The final ELSE branch is true for example on Windows XP which does not have pnputil.exe at all.
However, it is not recommended to use pnputil.exe to install drivers. Microsoft publishes for free the Driver Package Installer DPInst. There is a 32-bit (dpinst32.exe) and a 64-bit version (dpinst64.exe). Installation of one or more drivers is very easy using the driver package installer.
Let us look on how hardware producing companies which offer also the appropriate drivers like Intel ® install drivers using Driver Package Installer.
There is usually a directory structure in a driver installer package like:
VISTA32
VISTA64
WIN7-x86
WIN7-x64
XPx86
XPx64
Or a directory structure like:
VISTA
x86
x64
WIN7
x86
x64
XP
x86
x64
The directory structure varies from installer package to installer package, but that does not really matter and usually it is quite easy to see which driver files in which directory are for which version of Windows including architecture.
And there are additionally dpinst32.exe and dpinst64.exe being either stored in parent directory of all the subdirectories with the driver files or on just two driver directories directly in the directory containing the driver files.
Let us make the driver installation example very simple and assume there are only two driver files in a package, one for Windows x86 and one for Windows x64.
WIN-32
dpinst32.exe
*.cat
*.dll
*.inf
*.sys
WIN-64
dpinst64.exe
*.cat
*.dll
*.inf
*.sys
The code to install the 32-bit driver(s) in WIN-32 on 32-bit Windows and 64-bit driver(s) in WIN-64 on 64-bit Windows by a simple batch file executed either by 32-bit or 64-bit cmd.exe is very easy.
set "WINARCH=64"
if "%ProgramFiles(x86)%" == "" set "WINARCH=32"
cd WIN-%WINARCH%
dpinst%WINARCH%.exe
The environment variable ProgramFiles(x86) exists only on Windows x64 which makes it very easy to determine the architecture of Windows, see also WOW64 Implementation Details. The architecture of the processor does not really matter because on a PC with an AMD 64-bit (compatible) processor can be installed nevertheless a 32-bit Windows.
dpinst32.exe and dpinst64.exe started without any option simply install all drivers found in current directory.

Checking if file is 32bit or 64bit - on Windows

I'm compiling a program on my 64bit machine, but I'm not sure if it produces 32-bit or 64-bit output.. How can I check if a file is 32bit or 64bit on Windows?
You can use GNUfile for windows.
You can run the app thru PEID
Lastly (and preferred- less room for error)
With either Visual Studio C++ (at least express edition minimum) or the Platform SDK installed you can use dumpbin /headers to look at the PE header values.
The first value in the file header tells you the architecture: either 0x14C for x86 or 0x8664 for x64
Just run it and have a look at the Processes tab in Windows Task Manager. If there is a *32 suffix after the process name, it's 32-bit, otherwise it's 64-bit (provided you're on a 64-bit OS).
You could run the 'file' command from linux in a cygwin environment to test.
You could also place some debug statement like 'print sizeof(int)' (schematically) to check.
You may use EXE Explorer by MiTec, a small free tool. It also displays many other properites of the binary file it checks.
I had the same question as the original poster and the EXE Explorer works for me quite well.
http://ntinfo.biz/ - Detect It Easy.
Or just GNU Binutils objdump -f my.exe

Resources