0

I have faced a strange problem when trying to run a process from hidden window - the process I run runs in hidden like my process, Am I doing something wrong? I want to run that child process not hidden.

Process.Start(Path.GetTempPath() + "cleanup.exe", Path.GetDirectoryName(Application.StartupPath);
John Smith
  • 496
  • 1
  • 6
  • 20

1 Answers1

0

you can try with creating an object of Process class as below :

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");
}
Mohammad Arshad Alam
  • 9,694
  • 6
  • 38
  • 61