尝试从隐藏窗口运行进程时,我遇到了一个奇怪的问题 - 我运行的进程像我的进程一样在隐藏中运行,我做错了吗?我想运行不隐藏的子进程。
Process.Start(Path.GetTempPath() + "cleanup.exe", Path.GetDirectoryName(Application.StartupPath);
您可以尝试创建一个Process
类对象,如下所示:
Process objProcess = new Process();
objProcess.StartInfo.UseShellExecute = false;
objProcess.StartInfo.RedirectStandardOutput = true;
objProcess.StartInfo.CreateNoWindow = true;
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// Passing the batch file/exe name
objProcess.StartInfo.FileName = string.Format(strBatchFileName);
// Passing the argument
objProcess.StartInfo.Arguments = string.Format(strArgument);
try
{
objProcess.Start();
}
catch
{
throw new Exception("Batch file is not found for processing");
}