I am trying to play with the Environment.OSVersion.Version
object and can't really tell what version would indicate that the OS is Windows XP or higher (e.g. I want to exclude Windows 2000, ME or previous versions).
Press the Windows key on your keyboard or click on the Start icon in your taskbar, then enter system. A search result for System in the Control Panel should appear. Select that, and you should see a window that shows your Windows version and edition up top.
Use the System.OperatingSystem
object, then filter on the Major & Minor version numbers.
I've used these functions in the past:
static bool IsWinXPOrHigher() { OperatingSystem OS = Environment.OSVersion; return (OS.Platform == PlatformID.Win32NT) && ((OS.Version.Major > 5) || ((OS.Version.Major == 5) && (OS.Version.Minor >= 1))); } static bool IsWinVistaOrHigher() { OperatingSystem OS = Environment.OSVersion; return (OS.Platform == PlatformID.Win32NT) && (OS.Version.Major >= 6); }
Check the Major
property is greater than or equal to 5, and if 5 then Minor
is at least 1. (XP was 5.1, 2003 was 5.2, Vista/2008 were 6.0).
List of Windows Version Numbers on MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With