0

Possible Duplicate:
How to get parent process in .NET in managed way

I have an C# executable file that's invoked from another C# executable file. Is there a way to determine the name of the executable that invoked the executable that is currently running? I imagine there must be some way, but am having trouble Googling this. I imagine I must be using the wrong terminology.

Community
  • 1
  • 1
Darkenor
  • 4,349
  • 8
  • 40
  • 67
  • Isn't there Assembly.GetCallingAssembly - not sure if this works across AppDomains... – Charleh Aug 14 '12 at 16:06
  • you could give the second exe a parameter with the data you need. – elyashiv Aug 14 '12 at 16:07
  • @elyashiv Unfortunately specs require no command line parameters. :( – Darkenor Aug 14 '12 at 16:08
  • Related: http://stackoverflow.com/questions/1857037/determine-the-parent-process-of-the-current-app the question's tagged delphi, but the method is in the Windows API and so is usable in .NET as well. – KeithS Aug 14 '12 at 16:09
  • One thing to understand: using Process.Start will, by default, give the command to the Windows Shell to execute, creating a "top-level process" not considered to be the "child" of the caller. You must override this behavior using a ProcessStartInfo structure to define the parameters of the invocation, and set UseShellExecute to false. – KeithS Aug 14 '12 at 16:17

0 Answers0