string programpath = new System.Uri( System.Reflection.Assembly.GetExecutingAssembly( ).CodeBase ).LocalPath; // Or for Windows Forms: // string programpath = System.Windows.Forms.Application.ExecutablePath; string[] arguments = System.Environment.GetCommandLineArgs( ).Skip( 1 ).ToArray( ); // 需要引用 Linq System.Diagnostics.ProcessStartInfo startinfo = new System.Diagnostics.ProcessStartInfo( ); startinfo.FileName = programpath; startinfo.UseShellExecute = true; startinfo.Arguments = string.Join( " ", arguments ); System.Diagnostics.Process.Start( startinfo ); System.Environment.Exit( 0 ); // 退出代码0 或者其他值 // 如果是Windows窗体: // System.Windows.Forms.Application.Exit( );
日期:2020-04-11 22:50:25 来源:oir作者:oir