22

Does an executable running from the Windows “Program Files” folder behave differently when executing a program from C:\SomeFolder

Maybe UAC/delegation/other security layers are involved? Or its just a place to hold 3rd party application and that's all.

7
  • 1
    @Peter-ReinstateMonica I would not consider that quite the same. Program Files is mostly about organization, while /bin exists for other reasons as well (namely, so you don’t need $PATH to have hundreds of different entries like it ends up needing on Windows...). Sep 23 at 11:35
  • 7
    Historically one of the (hidden) reasons was to make sure that common software could deal with spaces in filenames.
    – MSalters
    Sep 23 at 12:03
  • 3
    @MSalters this failed. Even modern software (for some meanings of "modern") sometimes uses the 8.3 shortened names like PROGRA%1
    – fraxinus
    Sep 23 at 12:52
  • @AustinHemmelgarn Yeah, maybe. Another one is that /bin is actually for "OS" programs; the "Program Files" equivalent for 3rd party SW would be, as doneal24 pointed out in a comment to an answer, be /usr/local/bin. Sep 23 at 13:20
  • @MSalters in my german Windows, it has always been "Programme", without any space. Sep 24 at 15:12

4 Answers 4

35

Technically, programs can be installed or reside anywhere.

Storing installed programs under a common folder adds the benefit of organization so they can be quickly identified visually and with which security and other policies can be quickly and easily applied.

That's really about all the folder does. There is generally no technical difference between it and any other folder from an execution standpoint.

Note that I have never seen any definitive reference to support this other than things like this post, which I don't hold to be absolutely conclusive (even from Raymond Chen). The excerpt of interest from that link is

Rewind the clock to Windows 3.1. Microsoft didn’t provide guidance on where applications should install by default. As a result, they went everywhere. Some installed into the root of your C: drive. Some installed to a C:\LitWare directory. Some installed into the Windows directory. It was total chaos. Program Files was introduced in an attempt to bring order to chaos. Think of it as painting lines in a parking garage.

An exception to this, however, is a 32-bit executable running in a 64-bit installation. \Program Files on a 64-bit install holds 64-bit copies of the binaries whereas \Program Files (x86) holds 32-bit copies. If a 32-bit executable looks to \Program Files (which is historically the location of all program files before 64-bit editions of Windows were available) then WOW64 will redirct the 32-bit executable to look under \Program Files (x86) for other 32-bit binaries it needs. This makes it possible to have 32-bit and 64-bit versions of a program.

14
  • 3
    @Giacomo1968 Perhaps this for the existence of Program Files or here for differentiating between x86 and x64 versions of programs. Having all programs install into a common directory has always been a common thing, such as /usr/local/bin for Unix.
    – doneal24
    Sep 22 at 18:35
  • 2
    The only people who can tell you with a certain response is Microsoft. Anything else is conjecture.
    – John
    Sep 22 at 18:36
  • 24
    As someone who was around during the time of Windows 3.1, I can confirm the claim that "applications went everywhere". In addition, many programs broke when installed in a directory that contained a space, so having the default directory contain a space forced software developers to fix that.
    – Heinzi
    Sep 23 at 7:27
  • 5
    Note also that the default permissions for C:\Program Files are different than for C:\ . In the latter, regular users can create folders (probably for reasons of backwards compatibility). Program Files has a tighter security by default.
    – Heinzi
    Sep 23 at 7:29
  • 5
    Plenty of things do still install in C:\<product> or C:\<manufacturer>\<product>. It's really quite annoying. For tiny programs that work if simply copied and don't need to be installed, I use a c:\utils folder that also holds batch files and other commandline scripts. But sorting executables into some sort of structure is tidier and makes tracking things down easier
    – Chris H
    Sep 23 at 8:08
16

By default, Windows (10) sets certain permissions to the Program Files folder.

These are the permissions for a regular folder created in C: Normal permissions

These are the permissions of Program Files:

Program Files Permissions

What you can see here is:

  • Regular users can execute programs, but not make changes
  • Applications can read and execute other programs, but not make changes to them (or even to themselves)
  • "Trusted Installers" and administrators have full control

That means that you need admin rights (or need to run a trusted installer) to place a program in "Program Files", but once its placed there, anyone can run those programs. This prevents malicious programs from modifying other programs and it prevents users without admin rights from installing non-trusted programs. Further, programs are no longer able to write to their own directory (which was common practice during the 32bit era). This stops security vulnerabilities that change the program permanently and enforces the practice that programs write any persistent data they need to %appdata%.

However, those presets are just a default. It is possible to apply the same security policies to any other folder if desired.

3

Does an executable running from the Windows “Program Files” folder behave differently when executing a program from C:\SomeFolder

Program Files certainly has special status. While it does not change execution directly for a well behaved program, UAC will catch writes to that folder and redirect them. This could mean buggy software will work when installed there but not elsewhere.

This does not imply we absolutely need "Program Files" but it does make such a feature vastly easier to implement.

3
  • While true, this really falls under the concept of providing an easy way to apply security and policy. Do we need a \Progam Files folder to do this? No. Does it make it a whole lot easier to manage? Yes.
    – squillman
    Sep 23 at 21:08
  • This is only a matter of convenience, not necessity, since UAC can be turned off by the user.
    – Ed999
    Sep 24 at 16:40
  • Good point, I've clarified what I was answering.
    – Olivier
    Sep 25 at 0:20
0

Does an executable running from the Windows “Program Files” folder behave differently when executing a program from C:\SomeFolder

From a user's perspective, maybe. It all depends on the next part of your question.

Maybe UAC/delegation/other security layers are involved? Or its just a place to hold 3rd party application and that's all.

Yes, other security layers can heavily influence a program's actions. When it was first introduced, 95 kinda made all users administrators by default since there was normally only one account, at least for consumer systems. So basically anyone could write to the Program Files folder. There were a large number of users that saw the Program Files folder, (as well as the Windows folder) taking up a ton of space, and would delete them since they didn't think they were needed. Oooops, the computer won't boot for some reason.

XP, (maybe 2000) changed this and had a default administrator account and locked those folders so that basic users couldn't delete things or write to them, (that broke a LOT of programs). By default users were not admins, and if the program ran by a user tried to write to or delete things from the Program Files folder, (or inside a folder in there), they'd get denied and may not work right. Normally reading was wide open, so if that's all the program did, it'd be fine. There are ways to allow access to regular users so that they can write and delete things in there, or you could run the program as an administrator, and it would probably start working again.

As for running differently from C:\SomeFolder, maybe. If you lock down SomeFolder the same as Program Files they'll probably act the same. By default, if you create SomeFolder, you'll get full read/write/delete access to it.

My memory is starting to get a bit fuzzy on some of this, so I may be off by a version of Windows or two. I've been in the IT industry for 17 years, and been playing with computers since the late 80s early 90s.

2
  • Windows XP's out of box experience created an account separate from the built-in administrator account, but the first account was still an administrator, and the administrator account was still accessible. Windows Vista introduced elevation. This didn't apply to the built-in administrator account, but that was turned off by default anyway. The initial account was still an administrator, although you should still prefer a normal user account, which Vista also made somewhat easier to use by automatically prompting limited users to run installers using an administrative account.
    – Neil
    Sep 24 at 15:32
  • Deleting large files/directories is not just a Windows experience. I've had graduate students on SunOS compress /vmunix since it was such a large file and were then surprised when the workstation would not boot. Similar experiences on other *IX systems. One of the major reasons why I discourage programmers from having privileges.
    – doneal24
    Sep 24 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.