开发的一个小软件,根据命令行参数的不同执行不同的功能,希望通过主程序运行时的某个命令启动,但发现失败了,难道不能通过自己启动自己的多个副本?
private void button1_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Process.GetCurrentProcess().MainModule.FileName;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.WorkingDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
Process.Start(startInfo);
}
private void button1_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Process.GetCurrentProcess().MainModule.FileName;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.WorkingDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
Process.Start(startInfo);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货