How to find the Windows version from the PowerShell command line

前端 未结 25 1072
野的像风
野的像风 2020-12-22 15:51

How do I find which Windows version I\'m using?

I\'m using PowerShell 2.0 and tried:

PS C:\\> ver
The term \'ver\' is not recognized as the name o         


        
25条回答
  •  独厮守ぢ
    2020-12-22 16:15

    Since you have access to the .NET library, you could access the OSVersion property of the System.Environment class to get this information. For the version number, there is the Version property.

    For example,

    PS C:\> [System.Environment]::OSVersion.Version
    
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    6      1      7601   65536
    

    Details of Windows versions can be found here.

提交回复
热议问题