0

I've got some code that runs an executable (args.FileName) and at the same time launches a console window for that process:

var process = new Process
{
    StartInfo = new ProcessStartInfo(args.FileName, args.Arguments)
    {
        RedirectStandardOutput = false,
        RedirectStandardError = false,
        UseShellExecute = true,
        CreateNoWindow = false,
        WindowStyle = ProcessWindowStyle.Normal
    }
};

2 separate processes should be launched using this (both using args.FileName). I'm in the process of making this configurable so that the console window is launched and visible or not depending on configuration. However, how can I test that the console window has been launched or not (presumably on a separate process)? When I check the process id it's the id of the application that's been launched ( args.FileName - as expected) not the console window.

sr28
  • 4,728
  • 5
  • 36
  • 67
  • do you have access to the source of all exe that are run and can you make changes to them? – rene May 03 '23 at 07:55
  • @rene - No, I don't have access to the source of the exe that is run. – sr28 May 03 '23 at 08:26
  • That is too bad. Normally you would use an interprocess mechanism, for example a Semaphore / Mutex on Windows or a pid-file on *nix like systems. The (non)-existence of these tells you whether stuff is running. – rene May 03 '23 at 08:47

0 Answers0