Process.Start with different credentials with UAC on

后端 未结 4 1588
滥情空心
滥情空心 2020-12-02 23:54

I am trying to start another process with Process.Start running under different credentials with the UAC turned on. I get the following error:

System

4条回答
  •  醉梦人生
    2020-12-03 00:42

    I found some old project where I used code below and it worked at the time (looks similar to yours), maybe it won't help but still it's worth a try :

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.UseShellExecute = true;
    startInfo.WorkingDirectory = Environment.CurrentDirectory;
    startInfo.FileName = Application.ExecutablePath;
    startInfo.Verb = "runas";
    try
    {
        Process p = Process.Start(startInfo);
    }
    catch(System.ComponentModel.Win32Exception ex)
    {
        return;
    }
    

提交回复
热议问题