Determine if Program is Run from CMD or from Explo

2019-02-25 13:03发布

问题:

This question already has an answer here:

  • How can I get the PID of the parent process of my application 4 answers
  • How to get parent process in .NET in managed way 6 answers

In C#, is there a way to determine if program has been run from the command line (CMD.exe) or from explorer (any folder view, etc.)? Thanks.