Operating system discovery

I would like to know how to determine if the operating system is for Windows 7 people, I am a little newbie and have no idea how to do this. Please let me know if possible, and the code for this.

+6
source share
2 answers

See the Environment.OSVersion property on MSDN . This is a static property that returns the OperatingSystem object that Version has, and you can simply check the Major and Minor version numbers to see if it is 6.1 ( Windows 7 is actually version 6.1 ).

  Dim osVer As Version = Environment.OSVersion.Version If osVer.Major = 6 And osVer.Minor = 1 Then Console.WriteLine("win7!!") End If 
+6
source

I assume you are a little new to what you are actually using VB.NET, not classic VB 6.

In VB.NET you can use:

 Dim osVersion As String = System.Environment.OSVersion.ToString() 
+2
source

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


All Articles