C# 重启程序

Global.RootStart("peed.exe", "StartByGuard");
public static void RootStart(string exepath, string args)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(exepath, args);
            startInfo.UseShellExecute = true;
            startInfo.CreateNoWindow = true;
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.WorkingDirectory = Directory.GetParent(exepath).ToString();
            startInfo.Verb = "runas";  //设置启动动作,确保以管理员身份运行
            try { Process.Start(startInfo); }
            catch { }
        }

 

上一篇:C#中使用命令行命令


下一篇:c#调用python的三种方法