[Last Call] Learn how to a build a cloud-first strategyRegister Now


64-bit or 32-bit os version

Posted on 2007-07-22
Medium Priority
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
  • 2
  • 2

Assisted Solution

lorelogic earned 1500 total points
ID: 19544487
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

ID: 19545783
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.

Accepted Solution

lorelogic earned 1500 total points
ID: 19548585
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

ID: 19549708
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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

830 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