Start Process with administrator right in C#

后端 未结 5 1023
醉酒成梦
醉酒成梦 2020-12-06 07:04

I have to start a command line program with System.Diagnostics.Process.Start() and run it as Administrator.

This action will also be run by a Scheduled Task every da

5条回答
  •  死守一世寂寞
    2020-12-06 07:48

    I've just try to use :

    Process p = new Process();
    p.StartInfo.Verb = "runas";
    

    this works fine if I'm running my program as Administrator, but when the Scheduled Task runs it, it doesn't take the 'runas' in consideration I think.

提交回复
热议问题