• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 905
  • Last Modified:

Program Files x86 Path

Hi,
How can I get path to Program Files (x86) ?
0
mastiSoft
Asked:
mastiSoft
  • 3
  • 3
  • 3
  • +1
1 Solution
 
jschristian44Commented:
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
 
Jacques Bourgeois (James Burger)Commented:
System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
0
 
mastiSoftAuthor Commented:
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
Industry Leaders: 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!

 
Jacques Bourgeois (James Burger)Commented:
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
 
cupCommented:
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
 
mastiSoftAuthor Commented:
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
 
Jacques Bourgeois (James Burger)Commented:
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
 
cupCommented:
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
 
cupCommented:
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
 
mastiSoftAuthor Commented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now