64-bit or 32-bit os version

Posted on 2007-07-22
Last Modified: 2013-11-26
This should be an easy one, I hope! ;)

I'm creating an application in VB.NET and need to figure out if the operating system I'm running my app on is 64-bit or 32-bit. Does anyone know how to programatically figure this out?

I thought "System.Environment.OSVersion.Platform.ToString" would work but on my Vista 64-bit this returns "Win32NT". :(
Question by:Krazz
    LVL 3

    Assisted Solution

    Try using the System.Environment.GetEnvironmentVariable() Method, for example:

    String OSTest = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
    will return "X86" for 32 bit and will return "X64" for 64 bit.

    Author Comment

    Well, hmmmm. Are you sure? On my ssystem it returns AMD64 and I'm running Intel Core 2 Duo.

    I'm also very sceptical due to the fact that it is called PROCESSOR_ARCHITECTURE which really has nothing to do with the operating system.

    If I am wrong in my assuptions I apologize.
    LVL 3

    Accepted Solution

    Here is a link to a Microsoft Knowledgebase article to determine if the OS is 32 bit or 64 bit:

    This link also shows how to use the PROCESSOR_ARCHITECTURE envirionment variable to determine Process bitness:

    Note that the processor architecture EM64T, ia64 or AMD64 indicates a 64 bit OS. Itanium based processors are indicated with ia64 and x64 based processors are indicated with AMD64, since AMD created the original 64 bit design (even for Intel).

    Author Comment

    Thank you. Due to the fact that I have way too much in my head right now I thought two different users answered my question and I split the points up. Only after I realized you were the one posting both answers.

    Either way, thank you very much for your help. This did solve my problem. :)

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now