Solved

Program Files x86 Path

Posted on 2011-09-27
10
883 Views
Last Modified: 2012-05-12
Hi,
How can I get path to Program Files (x86) ?
0
Comment
Question by:mastiSoft
[X]
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
10 Comments
 
LVL 4

Expert Comment

by:jschristian44
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.
0
 
LVL 40
ID: 36710954
System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
0
 
LVL 1

Author Comment

by:mastiSoft
ID: 36714568
Hi
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'.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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?
0
 
LVL 11

Expert Comment

by:cup
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.
0
 
LVL 1

Author Comment

by:mastiSoft
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?
0
 
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.
0
 
LVL 11

Accepted Solution

by:
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

0
 
LVL 11

Expert Comment

by:cup
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.
0
 
LVL 1

Author Comment

by:mastiSoft
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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

726 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