PowerShell コマンドラインから Windows のバージョンを確認する方法 質問する

PowerShell コマンドラインから Windows のバージョンを確認する方法 質問する

使用している Windows のバージョンを確認するにはどうすればいいですか?

PowerShell 2.0 を使用していて、次のことを試しました:

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

どうすればいいですか?

ベストアンサー1

.NETライブラリにアクセスできるので、OSVersionの財産System.Environmentこの情報を取得するには、クラスを使用します。バージョン番号については、Versionプロパティがあります。

例えば、

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

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

Windowsバージョンの詳細については、ここ

おすすめ記事