0

I have some code where I need the explorer exe application to open within code, which I have working now by using this:

Process explore = Process.Start(@"...explorer");

For some reason this doesn't work when I try to wait for the exe to be closed:

explore.WaitForExit();

Any reason why this doesn't work and how to fix it? a code snippet would be appreciated.

cgaskey
  • 56
  • 9
  • I'm not 100% sure here, but I think: Explorer runs as a single process (view it in task manager - it's 1 process regardless of how many windows you have open), so Process.Start isn't actually starting a new process in this case - it's opening a window in the existing `explorer` process. – RB. Nov 02 '21 at 19:59
  • @RB. How would I then have an event for that window? – cgaskey Nov 02 '21 at 20:02
  • "doesn't work when I try to wait for the exe to be closed" - please [edit] question to clarify what you expect to happen and what actually happens. "Doesn't work" rarely is enough of an explanation for the problem raised in a question. – Alexei Levenkov Nov 02 '21 at 20:02

0 Answers0