VB get windows version then.....

Hewlett-packard / Hp pavilion dv5 notebook...
April 29, 2010 at 01:21:40
Specs: Microsoft Windows 7 Ultimate, 2 GHz / 4027 MB
is there a VB equivalent of this?:

VER | findstr /i "5\.0\." > nul
IF %ERRORLEVEL% EQU 0 set version=2000
VER | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 set version=XP
VER | findstr /i "5\.2\." > nul
IF %ERRORLEVEL% EQU 0 set version=2003
VER | findstr /i "6\.0\." > nul
IF %ERRORLEVEL% EQU 0 set version=Vista
VER | findstr /i "6\.1\." > nul
IF %ERRORLEVEL% EQU 0 set version=7

goto %Version%

except i really only need xp/vista/7 working on vb program when "enable" button is pressed it shuts down select services based on OS then cleans the ram out and a few temp files and when "disable" is pressed it restarts the services


See More: VB get windows version then.....

Report •

#1
April 29, 2010 at 09:36:28
Which VB?

Report •

#2
April 29, 2010 at 10:10:07
Visual basic. More specific: visual basic 2010

Report •

#3
April 29, 2010 at 12:52:05
Ah, VB.NET 4? You'll want to look at System.Environment.OSVersion.

Report •

Related Solutions

#4
April 29, 2010 at 15:25:44
yea i need it to get the OS version like XP or Vista or 7 then go to a set of commands for that specific one like in english terms


GET OS VERSION
if xp goto xp
if vista goto vista
if 7 goto 7

:xp
does this stuff if xp is returned

:vista
does this stuff if vista is returned

:7
does this stuff is 7 is returned

OR
in more of a batch way

GET OS
Set Version=GOTTEN OS

%Version%
does this stuff if xp is returned

%Version%
does this stuff if vista is returned

%Version%
does this stuff is 7 is returned


Report •

#5
December 21, 2010 at 01:05:37
'OS Verification
strComputer = "."
Set oWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOSInfo = oWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each oOSProperty in colOSInfo
strCaption = oOSProperty.Caption
Next


If InStr(1,strCaption, "XP", vbTextCompare) Then strOSFamily = "Windows 7"

'Put in your commands here for Windows 7

If InStr(1,strCaption, "Vista", vbTextCompare) Then strOSFamily = "Vista"
'Put in your commands here for Vista

If InStr(1,strCaption, "XP", vbTextCompare) Then strOSFamily = "XP"

'Put in your commands here for XP

If strOSFamily = "" Then
Wscript.Echo "OS unsupported. (Script runs on XP, Vista & Windows 7 only!)"
WScript.Quit [ExitCode]


Report •

Ask Question