Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to detect Windows 64-bit platform with .NET?  (Read 52159 times)

0 Members and 1 Guest are viewing this topic.

Wainwright

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    How to detect Windows 64-bit platform with .NET?
    « on: April 02, 2020, 11:23:40 AM »
    In a .NET 2.0 C# application I use the following code to detect the operating system platform:

    string os_platform = System.Environment.OSVersion.Platform.T oString();
    This returns "Win32NT". The problem is that it returns "Win32NT" even when running on Windows Vista 64-bit.

    Is there any other method to know the correct platform (32 or 64 bit)?

    Note that it should also detect 64 bit when run as a 32 bit application on Windows 64 bit.

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: How to detect Windows 64-bit platform with .NET?
    « Reply #1 on: April 02, 2020, 12:59:23 PM »
    Copy pasted question from here.

    I was trying to dereference Null Pointers before it was cool.