C# 开启一个新进程并为新进程设置工作目录
Process p = new System.Diagnostics.Process(); //设置新进程的工作目录,如果不设置那么新进程的工作目录为开启这个进程的工作目录 p.StartInfo.WorkingDirectory = @"E:\会计助手代码\CNCTKJPT\CNCTKJPT\bin\Debug"; //设置进程启动文件 p.StartInfo.FileName = @"CNCTKJPT.exe"; //设置进程启动参数 p.StartInfo.Arguments = DateTime.Now.Ticks.ToString(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = false; p.StartInfo.RedirectStandardOutput = false; p.StartInfo.RedirectStandardError = false; p.StartInfo.CreateNoWindow = false; //开启进程 p.Start();