Determine installed PowerShell version

前端 未结 19 2412
半阙折子戏
半阙折子戏 2020-11-22 09:40

How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?

19条回答
  •  忘了有多久
    2020-11-22 10:18

    You can directly check the version with one line only by invoking PowerShell externally, such as from Command Prompt

    powershell -Command "$PSVersionTable.PSVersion"
    

    According to @psaul you can actually have one command that is agnostic from where it came (CMD, PowerShell or Pwsh). Thank you for that.

    powershell -command "(Get-Variable PSVersionTable -ValueOnly).PSVersion"
    

    I've tested and it worked flawlessly on both CMD and PowerShell.

提交回复
热议问题