Program Files x86 Path

Posted on 2011-09-27
Last Modified: 2012-05-12
How can I get path to Program Files (x86) ?
Question by:mastiSoft
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +1

Expert Comment

ID: 36710398
I am unsure of what you mean.  Please clarifiy a little better?  The Program Files (x86) is where Windows stores files that are specific for 32-bit software.  All of the programs you install go into there.  It is in My Computer>C:>Program Files (x86).  If you want a shortcut to there to add to your desktop, just right click on the Program Files folder and click create shortcut.  Then drag it to your desktop.
LVL 40
ID: 36710954

Author Comment

ID: 36714568
I need to get path to application that have exe file in Program Files(x86). Yes the PC is 64-bit bit.
I used the last suggestion and see what happens:
Error103      'ProgramFilesX86' is not a member of 'System.Environment.SpecialFolder'.
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

LVL 40
ID: 36715029
You will have to move to a newer version of Visual Studio. Older versions were designed before Microsoft started to use the x86 Program Files and do not have a definition for that special folder.

What version do you use?

I am puzzled by you Error 103. .NET does not use error codes. Could you sent a PrintScreen?
LVL 11

Expert Comment

ID: 36812848
It is in the environment variable %programfiles(x86)%.  If you get the environment variable, expand it and use it as part of the file path, then you don't need to mess with the SpecialFolders.

Author Comment

ID: 36817574
to JamesBurger:
I use VS 2010. But I use to use Framework 2 because I don't want  tell to  my users to  install Framework 4 only to rum my application.
to Cup:
"It is in the environment variable %programfiles(x86)%." can you give me some example?
LVL 40
ID: 36819132
Strange idea not to ask users to install Framework 4. Unless you work with a very restrictive system manager that would still run Windows 3.1 because he fears that anything newer is not stable or secure enough, there is no reason to have your users make the move if you are developing in a tool that has been geared for that version.

Its like continuing to develop for VB4 because you do not want your users to install the VB6 runtime. You will tell me that the runtimes were a lot smaller in those times, but 2 GB hard disks where also smaller than what we get to day.

The framework installs in a snap. Framework 4 commes with framework 2 built-in, with extras, bugs that have been solved since 2007 (the last SP for framework 2.0), and enhanced performance on the top of that.

They have a 64-bits computer and run on a technology that is 8 years old? Why have such a computer if you use something that cannot access all its power? When you want to access specific features of their computer, you cannot do it because framework 2.0 is not designed for those features.

Don't get me wrong. I do not have a cell phone. I won't move to Denari (SQL Server 2012?) until I am forced to. I am not the kind of guy to jump on every new technology. But the framework 4.0 is old enough to have proven that it is stable and it has been designed for the types of computers you users have.

Restraining yourself and your users to the 2.0 framework is like continuing to use leaded gas in your car or listening to music on tape cassettes that cannot play at the right speed anymore, when the MP3 player (Framework 4.0) is free for the taking.

Unless they are in a very controlled environment, the first or second little thing they will grab for free on the Internet will require Framework 4.0 anyway. They might already have it unknowingly.
LVL 11

Accepted Solution

cup earned 500 total points
ID: 36889964
Something like this
Imports System.Environment
Module EnvVar

    Sub Main()
        Dim progfiles As String
        progfiles = Environment.GetEnvironmentVariable("programfiles(x86)")
        Console.WriteLine("It is " & progfiles)
    End Sub

End Module

Open in new window

LVL 11

Expert Comment

ID: 36898722
I can empathize with mathiSoft.  I work in some environments which don't even have .net framework installed.  Sometimes the choice is down to whether you install .net framework for that one program or write it in something like VB6 or C++ that doesn't require .net framework.

Author Comment

ID: 36955039
Hi Jamesburger,
You don't do much programming for the US military, do you? No, I didn't think so.
Thanks for your extensive and useless lesson.

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

719 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