winform程序重启

winform程序重启的方法:

        private void ReStart()
        {
            string processName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
            //设置启动进程的初始目录
            //info.WorkingDirectory = Application.StartupPath;
            //设置启动进程的应用程序或文档名
            info.FileName = processName;
            //设置启动进程的参数
            info.Arguments = "RESTART";
            //启动由包含进程启动信息的进程资源
            try
            {
                System.Diagnostics.Process.Start(info);
            }
            catch (System.ComponentModel.Win32Exception we)
            {
                MsgBox.Show(we.Message, "系统提示", MsgBoxButtons.OK, MsgBoxIcon.Information);
                return;
            }

            Application.Exit();
            System.Environment.Exit(0);
        }
Winform重启
原文地址:https://www.cnblogs.com/ningheshutong/p/4364717.html