Why does Microsoft recommend "C:\Program Files" for default installation destination? Are there any specific reason for that? And if I change the location is that going to effect the performance of the system and the application?
views:
372answers:
12"C:\Program Files" is just a convention, although it certainly is handy to have a single directory where all program files reside. The directory can also be hidden from clumsy casual users who might otherwise unintentionally delete program files. However, with that said, you can install an application anywhere you can write to.
Another thing to consider is that often in Enterprises, security is setup on the machine so that a typical user can only install to the C:\Program Files directory.
It makes computer management easier.
- Support staff knows exactly where applications are located.
- By separating the rarely changing applications ("C:\program Files") from the rapidly change user data ("C:\Documents and Settings") more efficient backup strategies can be implemented.
- It allows the C:\Program Files directory tree to be set as "Everyone readable; Admin-writable", to prevent virus installs and accidental deletion.
That's the location that most users, and admins, expect to find their applications installed in. It's really more of a convention than anything else. I would suggest that it's a reasonable default, but you could allow the user the ability to change the location during the installation if they desire. In any event you should write your application to work without a dependence on a fixed installation directory if at all possible (and generally it is). You shouldn't see any performance differences from another install location unless it happens to be on a slower or more heavily accessed drive.
Since it is the default, lots of things in Windows just assume that's what it is.
It's not a performance issue, but a user changing it might break things unexpectedly. It might be a good thing to test for.
You should definitely refer to the %ProgramFiles% environment variable in your program rather than a hard-coded path.
It's a convention that ensures proper interoperation between your program and the OS's application and security models. If you're writing typical application software, I would strongly recommend against going against the convention here. As an admin, an app that tried to install somewhere else should send up red flags all over the place.
There is no particular reason you NEED to install in any particular folder (barring a few exceptions where you can't).
However, think hard about why you're asking this. If you want to hardcode your path, that is laziness and you can get burned on it. Make sure your program can handle being installed in the folder of your user's choice. What if you hardcode in C:\BuggyProgram\ and your user wants to install you in his J: drive? You're FUBAR'ed then.
In short, a well written program doesn't really CARE where it is installed. Take that approach.
Don't forget that in Vista they've also added a little more security on the Program Files folder itself so that rogue programs can't mess up other programs in the same general directory area. If you're trying to follow the Microsoft conventions, they now ask that you put all "Common" application data in the C:\ProgramData folder, which gives the application and a little more control over it.
In addition, you can also use the CSIDLs to define your program data and program files folders so that they'll be properly referenced regardless if it is XP or Vista (where some folders have changed).
It is convenient for me to be able to know where to look to find the various programs installed on my computer.
I have had software the created and installed itself in "c:\ProgramFiles" - so not only did they hard code it but they couldn't cope with spaces in the path.
IMHO, it started as an 'anti piracy' measure ( along with registry instead of INI etc. )
In good old DOS days .. moving software was as easy as zipping directory and unzipping on other folder.
Since 99% of Windows machines are used by single user, the 'multi-user-need' is a bad attempt to give an alternate view.
No hell will break loose if you choose to install program elsewhere. If they are command line progreams ( like microsoft SDK ), it makes sense to keep it as 'd:\sdk', to keep PATH readable.
if you want your software+data to be movable across machines easily, use anything.
"C:\Program Files" is actually only the default in English versions of Windows. In the German version, it's called "C:\Programme", so never rely on the fact that this folder exists or what its name is. Always use %ProgramFiles%
.
I also assume that the name was introduced to make more programs handle spaces (and other weird characters in paths) correctly :)