How to identify the currently executing operating system in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
    Public Shared Sub Main()
        Dim os As OperatingSystem = Environment.OSVersion
        Dim pid As PlatformID = os.Platform

        Select Case pid
            Case PlatformID.Win32NT, PlatformID.Win32S, PlatformID.Win32Windows, PlatformID.WinCE
                Console.WriteLine("Windows operating system")
            Case PlatformID.Unix
                Console.WriteLine("Unix operating system")
            Case Else
                Console.WriteLine("Invalid identifier")
        End Select
    End Sub
End Class


 
 
 
 
' run:
'
' Windows operating system
'

 



answered Nov 19, 2023 by avibootz

Related questions

2 answers 235 views
2 answers 248 views
1 answer 133 views
1 answer 282 views
1 answer 126 views
...