How to use CreateProess function to call pnputil.exe?

涛 王 71 Reputation points
2021-04-22T08:43:41.547+00:00

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 - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
1,890 questions
No comments
{count} votes

Accepted answer
  1. Song Zhu - MSFT 906 Reputation points
    2021-04-23T05:50:10.79+00:00

    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.

    No comments

0 additional answers

Sort by: Most helpful