C#以管理员用户打开某个程序

        static void Main(string[] args)
{
string path = @"C:\Windows\AppPatch\AppLoc.exe";
ProcessStartInfo P = new ProcessStartInfo();
P.FileName = path;
P.UserName = "administrator"; System.Security.SecureString ss = new System.Security.SecureString();
ss.AppendChar('s');
ss.AppendChar('');
ss.AppendChar('');
ss.AppendChar('');
ss.AppendChar('');
ss.AppendChar(''); P.Password = ss;
P.UseShellExecute = false;
P.StandardOutputEncoding = Encoding.UTF8;
Process.Start(P); // System.Diagnostics.Process.Start(@"D:\Program Files\1\InputEasy.exe",{ Verb = "runas" });
// string path = @"D:\Program Files\1\InputEasy.exe";
// string path = @"C:\Windows\AppPatch\AppLoc.exe";
//string userName, SecureString password, string domain
//Process.Start(new ProcessStartInfo(path) { Verb = "runas" }); // Process.Start(path, @"Administrator", ss, "yuming"); }
上一篇:JavaScript浏览器解析原理


下一篇:【随笔】设置title标题图标为自定义图片