The requested operation requires elevation

I try to run an exe file from a different user account name, it shows the following error

    System.ComponentModel.Win32Exception: The requested operation requires an elevation
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start()
    at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)

Here is my code

ProcessStartInfo pro = new ProcessStartInfo(application);
pro.UseShellExecute = false;
pro.Verb = "runas";
pro.WorkingDirectory = workingdirectory;
pro.RedirectStandardInput = true;
pro.RedirectStandardOutput = true;
pro.CreateNoWindow = true;

Process process = Process.Start(pro);

How to resolve this?

+4
source share
1 answer

Sorry, you cannot do

  • runs with higher permissions and
  • I / O redirection

at the same time.

Cause:

  • Verbrecognized only when UseShellExecute = truebut
  • IO redirection required UseShellExecute = false.

Additional Information:

, runas, , /. , , , .

+10

All Articles