title: How can I detect whether or not I am in powershell from a command line?
body: <p>I am creating a standard windows BAT/CMD file and I want to make an IF statement to check whether or not this CMD file is run from PowerShell. How can I do that?</p>
  
  <p><em>Edit:</em> My underlying problem was that <code>test.cmd "A=B"</code> results in <code>%1==A=B</code> when run from CMD but <code>%1==A</code> and <code>%2==B</code> when run from PowerShell. The script itself is actually run as an old Windows Command line script in both cases, so checking for Get-ChildItem will always yield an error.</p>