OsInfo
Helpers and extensions when comparing Windows versions.
Install / Use
/learn @angularsen/OsInfoREADME
OsInfo - Operating System Info
Compare operating system versions, check if OS is 32/64-bit and what service pack is installed. Targets .NET 3.5 Client. Supports Windows 8.1 and all previous Windows versions.
NuGet
To install, type Install-package OsInfo into Package Manager Console in Visual Studio or visit the nuget page.
Examples
public void PrintCurrentOs()
{
OperatingSystem currentOs = Environment.OSVersion;
Console.WriteLine("Current OS: " + currentOs);
Console.WriteLine("Service pack: " + (currentOs.GetServicePackVersion() ?? (object)"(null)"));
// In .NET 4.5+ you can use Environment.Is64BitOperatingSystem instead
Console.WriteLine("Is 64-bit: " + currentOs.Is64Bit());
Console.WriteLine();
Console.WriteLine("Greater than or equal to XP : " + currentOs.IsGreaterThanOrEqualTo(OsVersion.WinXP));
Console.WriteLine("Greater than or equal to Vista : " + currentOs.IsGreaterThanOrEqualTo(OsVersion.Vista));
Console.WriteLine("Greater than or equal to Win7 : " + currentOs.IsGreaterThanOrEqualTo(OsVersion.Win7));
Console.WriteLine("Greater than or equal to Win8 : " + currentOs.IsGreaterThanOrEqualTo(OsVersion.Win8));
Console.WriteLine("Greater than or equal to Win8.1 : " + currentOs.IsGreaterThanOrEqualTo(OsVersion.Win8Update1));
Console.WriteLine();
Console.WriteLine("Equal to Win8 : " + currentOs.IsEqualTo(OsVersion.Win8));
Console.WriteLine("Equal to Win7 : " + currentOs.IsEqualTo(OsVersion.Win7));
Console.WriteLine();
Console.WriteLine("Less than or equal to Win8 : " + currentOs.IsLessThanOrEqualTo(OsVersion.Win8));
Console.WriteLine("Less than or equal to Win7 : " + currentOs.IsLessThanOrEqualTo(OsVersion.Win7));
Console.WriteLine();
Console.WriteLine("Less than Win8 : " + currentOs.IsLessThan(OsVersion.Win8));
Console.WriteLine("Less than Win7 : " + currentOs.IsLessThan(OsVersion.Win7));
}
Yields:
Current OS: Microsoft Windows NT 6.2.9200.0
Service pack: (null)
Greater than or equal to XP : True
Greater than or equal to Vista : True
Greater than or equal to Win7 : True
Greater than or equal to Win8 : True
Greater than or equal to Win8.1 : False
Equal to Win8 : True
Equal to Win7 : False
Less than or equal to Win8 : True
Less than or equal to Win7 : False
Less than Win8 : False
Less than Win7 : False
Notes
Windows 8.1 will report as Windows 8 (6.2.9200) for applications that do not explicitly specify compatibility with Windows 8.1 in their app manifest. Read more.
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
