You must Sign In to post a response.
  • Category: Windows 8

    OS Name differ through command and through c# code

    Hi Team,

    Today I faced one typical issue while doing my code, I want to retrieve the system OS Information, I approached in different ways.

    1) through command prompt run the following script

    c:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"


    output :

    OS Name: Microsoft Windows 8.1 Pro
    OS Version : 6.3.9600 N/A Build 9600

    2) through C# code using below

    OperatingSystem os = Environment.OSVersion;
    Version vs = os.Version;


    output:
    Microsoft Windows NT 6.2.9200.0
    6.2.9200.0

    See the difference between both through command version is 6.3 through code version is 6.2, how it's possible? I'm totally confused after see the difference, if any one face this type of problem then share your thoughts for the same.
  • #763684
    see the below attachment for your reference
    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

    Delete Attachment

  • #763685
    I got the solution for the same, as per Microsoft blog "The OSVersion property reports the same version number (6.2.0.0) for both Windows 8 and Windows 8.1." In order to include this in our application we need to include manifest file into our project then it will work 100%.

    Refer below link to include manifest code

    https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments