Tutorial :How to check which Operating System?



Question:

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


Solution:1

Run the ver command and parse the string output that it gives you.


Solution:2

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 the Caption to capture the string you want.


Solution:3

You should use ver and find.
Example:

ver | find "XP"  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »