I have a python application that has a shell that needs to do some setup based on whether the shell it's running in is the Windows Command Prompt (cmd)
or Powershell
.
I haven't been able to figure out how to detect if the application is running in powershell
or cmd
.
From my searches on stackoverflow and Google, it seems the only way to do this is to use psutil
to find the name of the parent process.
Is there a nicer way?