Search code examples
powershellsshcmdopenssh

How do I determine if I'm in powershell or cmd?


I've been playing with OpenSSH on Windows and it looks like the normal Unix aliases are missing. I'm not sure whether it's starting powershell or cmd when I log in to a Windows machine via SSH. What's the correct way to see the currently running shell on Windows?


Solution

  • All credit goes to PetSerAl, this had to be posted as an aswer:

    (dir 2>&1 *`|echo CMD);&<# rem #>echo PowerShell
    

    Within Win32-OpenSSH this command also works, and outputs CMD.

    NB : Win32-OpenSSH seems a bit limited, cd is not recognized on my system.