如何从 PowerShell 命令行查找 Windows 版本 [英] How to find the Windows version from the PowerShell command line

查看:87
本文介绍了如何从 PowerShell 命令行查找 Windows 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到我使用的 Windows 版本?

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

我正在使用 PowerShell 2.0 并尝试过:

I'm using PowerShell 2.0 and tried:

PS C:\> ver
The term 'ver' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify tha
t the path is correct and try again.
At line:1 char:4
+ ver <<<< 
    + CategoryInfo          : ObjectNotFound: (ver:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我该怎么做?

推荐答案

由于您可以访问 .NET 库,因此您可以访问 OSVersion 属性 System.Environment 类以获取此信息.对于版本号,有 Version 属性.

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.

例如

PS C:\> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
6      1      7601   65536

Windows 版本的详细信息可以在 此处.

Details of Windows versions can be found here.

这篇关于如何从 PowerShell 命令行查找 Windows 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆