How can I programatically check that I am running Windows 8.1 using cmd.exe or PowerShell?
3 Answers
Powershell
get-wmiobject win32_operatingsystem will return several properties you can use to check the OS.
get-wmiobject win32_operatingsystem|select-object name,caption,buildnumber,version|format-list name : Microsoft Windows 8.1 Enterprise|C:\WINDOWS|\Device\Harddisk0\Partition2 caption : Microsoft Windows 8.1 Enterprise buildnumber : 9600 version : 6.3.9600 2 Comments
WalkingRandomly
Interesting that we need to use
win32_operatingsystem on a 64bit operating system.Frode F.
The class-names wasn't changed due to compatibility reasons.
Win64_* names for 64bit os would just add complexity without giving any benefits.