question

38177934 avatar image
0 Votes"
38177934 asked SongZhu-MSFT edited

How to use CreateProess function to call pnputil.exe?

I started visual studio with admin, and call the CreateProcess function to start pnputil,However, the CreateProcess return error is 2

Why?

I alse try using CreateProcess to call Dism.exe that was OK

windows-api
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SongZhu-MSFT avatar image
0 Votes"
SongZhu-MSFT answered SongZhu-MSFT edited

The reason for this error is that 32-bit applications are automatically redirected to the SysWOW64 folder, and the folder does not have pnputil.exe.

You can refer to this thread and the comments below.

So you only need to modify the program to 64 to (x64), or disable the system's file redirection function, and you can call successfully.

Note: After the process is created successfully, you may still receive error 5 (access denied), but don't worry, you can refer to this thread.



If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.