简体   繁体   English

如何在C#中以编程方式确定Windows 7的子版本?

[英]How do I determine sub versions of Windows 7 programatically in C#?

I need to determine whether a machine is running Windows 7 Pro, or Windows 7 Embedded. 我需要确定计算机是否正在运行Windows 7 Pro或Windows 7 Embedded。 Environment.OSVersion returns the same version number on both systems, as does the Windows Management Interface. 与Windows管理界面一样,Environment.OSVersion在两个系统上都返回相同的版本号。 I'm looking at the Registry for some form of identifier, but I'm wondering if there is a solution I haven't considered yet. 我正在寻找注册表中的某种形式的标识符,但是我想知道是否有我尚未考虑的解决方案。

Run the above code to get the OS details: 运行以上代码以获取操作系统详细信息:

  using System;

    public class Example
    {
        public static void Main()
        {
            var os = Environment.OSVersion;
            Console.WriteLine("Current OS Information:\n");
            Console.WriteLine("Platform: {0:G}", os.Platform);
            Console.WriteLine("Version String: {0}", os.VersionString);
            Console.WriteLine("Version Information:");
            Console.WriteLine("   Major: {0}", os.Version.Major);
            Console.WriteLine("   Minor: {0}", os.Version.Minor);
            Console.WriteLine("Service Pack: '{0}'", os.ServicePack);
            Console.ReadKey();
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何确定在 c# windows OS 中以编程方式创建或操作的文件 - How do i determine which files are created or manipulated by a specific process programatically in c# windows OS 如何在Windows 7中使用C#以编程方式打印到标签打印机 - How do I programatically print to a label printer in windows 7 using C# C#-如何以编程方式最小化最上面的窗口? - C# - How do I programatically minimize the topmost window? 如何以编程方式在webBrowser控件中选择文本? C# - How Do I programatically select text in a webBrowser Control? c# 如何以编程方式(C#)确定.docx文件的页数 - How to programatically (C#) determine the pages count of .docx files 如何在Visual C#项目之间同步版本? - How do I sync versions between Visual C# projects? 如何确定我是否对数据库具有执行权限? - How do I determine if I have execute permissions on a DB programatically? 如何确定C#中的多播数据包的源IP? - How do I determine the source IP of a multicast packet in C#? 如何在C#中确定方法参数的适当类型? - How do I determine the appropriate type for method parameters in C#? 如何在C#中的Unicode流中确定单词边界? - How do I determine a word boundary in Unicode stream in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM