Why use C:\Progra~1

So I was hoping you guys could provide some insight?

I'm about to release some software and why should I set it to install in C:\Program Files\MyDir, and not just C:\MyDir?

The only reason I can think of is that you need to be an Administrator to modify anything in Program Files but are there any other benefits\reasons?

Besides convenience and "looking pretty"? None. C:\MyDir will be more than fine. With the added Vista restrictions on C:\Program Files\ I find myself installing more and more software and third-party software in the root directory because of hassles with development.
 
I'm about to release some software and why should I set it to install in C:\Program Files\MyDir, and not just C:\MyDir?

Quick question - is that hardcoded into the installation? Surely the user can select where to install it? I know at our QA (quality assurance) team purposely install stuff to their D: drives etc just to make sure everything (paths etc) is dynamic. Also some people don't have C as their system drive (worth a thought)
 
You shouldn't hard code the install path and you should certainly not hard code any references to the install path either. This WILL break something if someone overrides your installer.

There are plenty of examples for most visual developers on choosing the installation path, and most development languages expose a number of environmental variables for different types of actions. The reason it is good to install into [drive:]/Program Files/... is due to several reasons, but mostly it keeps the system at least somewhat organised. Naturally, most installers will give the option (if permitted by the builder) for the user to decide where to install the application. So, let the user have the choice. Don't dictate it with your application.
 
1. Stick to defaults. ie. Install you app to program files dir but allow this to be overriden by the user.
2. Never let your app write stuff to the program files dir except for when its a software update or something becuase you'll need admin privilages and to add that to your app is a pain and you don't want to run your app as admin user - only when updates need to run or you really need to write something in the program files dir but generally stay away from writing to program files dir.
3. Can't remember what I wanted to say on point 3...
 
Remember that program files is for programs, and the user data directories is for settings and data.

Also - don't assume it'll be Progra~1, it could be Progra~2 or Progra~3 as well.

Yes but it is different for Vista and XP. Vista has a Program Data directory, as well. Gotta love Microsoft consistency.

But as an exception to the rule: you install Apache. The /htdocs directory which houses the source files for all web applications (these file may be very volatile) is defaulted to a /Program Files subdirectory. So in this case, the /Program Files directory is also for data (admittedly this is mostly a problem for developers, but can be a problem for client servers). As such, in Vista, my Apache directory sits in the root to allow for easy updates and access. I do the same thing, as a result, for my clients regardless of the OS.
 
Don't even assume "X:\Program Files", use the correct API's to retrieve the program files folder. I for one, uninstall any application that does not adhere to the standard locations. I have known people to use C:\Apps and even D:\ as the program files directory. You can change it by editing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and the key is "ProgramFilesDir".
 
Wasn't aware of that registry setting. I assume Windows applies all the "Program Files" restrictions to whichever folder is referenced in that registry key?

It is supposed to but I have not tested it on Vista. Bascially Windows picks up most of its "special" folders from either the location I listed or the "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" one for personal locations.

I will test it in the next week or so when I move to Vista 64.
 
As pretty much everyone in here already mentioned, by all means avoid hard-coding he path. As I have 2 HDDs with Vista and XP running in dual-boot, my primary drive is basically D: (XP). I boot into Vista about 2% of the time and hate it when a proggy wants to install to my "Vista" drive...
 
Don't even assume "X:\Program Files", use the correct API's to retrieve the program files folder. I for one, uninstall any application that does not adhere to the standard locations. I have known people to use C:\Apps and even D:\ as the program files directory. You can change it by editing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and the key is "ProgramFilesDir".

Yup, Vista 64 even defaults to sticking 32-bit apps in "C:\Program Files (x86)", so "Program Files" is not sacred.
 
Top
Sign up to the MyBroadband newsletter
X