try
{
Process proc = new Process();
proc.StartInfo.WorkingDirectory = @"C:\Users\Administrator\source\repos\sss\sss\bin\Debug\netcoreapp2.1\";
proc.StartInfo.FileName = " cmd.exe ";
proc.StartInfo.Arguments = @" /c C:\Users\Administrator\source\repos\sss\sss\bin\Debug\netcoreapp2.1\sss.bat";
proc.Start();
proc.Close();
proc.Dispose();
string file = proc.StartInfo.WorkingDirectory + "sss.bat";
Thread.Sleep(300);
Console.WriteLine("程序sss已开启");
Process[] getProcessName = Process.GetProcesses();
foreach (Process pro in getProcessName)
{
if (pro.ProcessName == "dotnet")
{
if (!ht.Contains(pro.Id))
{
ht.Add(pro.Id, file);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
}
你应该设置你全屏的form 的topmost属性为true了,如果你没设置这个属性,新启动的程序都是在前面的