How to check which operating system?

How to check the OS version in a batch file or via vbs in a Windows 2k / 2k3 environment? You know ... Something like ...: "If winver Win2k then ... or if winver Win2k3 then ....

+3
source share
3 answers

Run the ver command and parse the output of the string that it will provide you.

+4
source

you can use vbscript

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOS in colOSes
  Wscript.Echo "Computer Name: " & objOS.CSName
  Wscript.Echo "Caption: " & objOS.Caption 'Name
  Wscript.Echo "Version: " & objOS.Version 'Version & build
Next

Use Caption to capture the desired line.

+3
source

ver find.
:

ver | find "XP"
+1

Source: https://habr.com/ru/post/1722297/


All Articles