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 { }
        }

 

posted @ 2021-07-13 10:28  黄立明02  阅读(136)  评论(0编辑  收藏  举报