"C:\Program Files" on Windows Vista+ (x64)

3

Exactly what is the difference between:

C:\Program Files
C:\Program Files (x86)
C:\ProgramData

I have two questions:

  1. Why are they different?
  2. How do I decide which one to look in for any given resource, to avoid having to look in them all and merge the information in my head?

Neil Barnwell

Posted 2010-08-20T09:23:11.017

Reputation: 791

Answers

7

Briefly

Program Files is where 64bit software is installed.

Program Files (x86) is where 32bit software is installed.

Program Data is where both sets of programs should write data (such as configuration data, for example) that they want to store for all users (so can't go in a single users AppData or MyDocs) and that does not belong in registry.


The difference between the two ProgFiles folders allows you to have two different versions of software installed (for example Internet Explorer comes in both 32 and 64 bit flavors installed together) because Windows silently redirects requests from software in the (x86) folders.


As for question 2, you can probably ignore Program Data most of the time (nothing should be installed in there), but I often find myself jumping between the two ProgFiles folders so I'll be looking for other answers here to help with that.

DMA57361

Posted 2010-08-20T09:23:11.017

Reputation: 17 581

Is there any reason why 64-bit software and 32-bit software had to be split in this way? I mean, it's just files on the disk, isn't it? – Neil Barnwell – 2010-08-20T09:32:00.940

No idea! I've heard it's for compatability reasons. But all my 32bit and 64bit games (not many in the latter category) are installed in C:\Games and I have not problems with either. Plus I've loads of utilities I run straight off my D:. – DMA57361 – 2010-08-20T09:34:41.470

This question on ServerFault might be useful. I'll add some of the key points to my answer. – DMA57361 – 2010-08-20T09:41:05.423

3It's important for some programs! Some compilers, Integrated Development Environments and similar programs have need for both 32bit version and 64 bit version. It's not uncommon to find 64 bit in Program Files and 32 in Program Files (x86). Still, there is no need for directories o be called like that. They may as well be called a and b. It's just that x86 hints at its contents. – AndrejaKo – 2010-08-20T09:42:17.500

Note however that some programs can have "C:\Program Files" has their default path, directly written, without caring about the appropriate folder. That's how you end with 32-bit programs in the folder in theory dedicated to 64-bit. – Gnoupi – 2010-08-20T09:47:44.183

2Indeed, those that don't use the %ProgramFiles% environment variable cannot be automagically redirected by Windows. – DMA57361 – 2010-08-20T09:56:59.783

1

This blog post gives quite good explanation of the various 16/32/64-bit folders: http://piers7.blogspot.com/2010/07/64-bit-explained.html

– petergil – 2010-08-20T11:50:26.797

@DMA57361, @Gnoupi: It is theoretically possible, though, as Windows 64-bit already redirects 32-bit applications writing to C:\Windows\System32 into C:\Windows\SysWOW64. – Hello71 – 2010-08-20T16:59:52.227

@Hello, @Mario's answer has the link to here which indicates redirects are done assuming programs call a specific API function to get the relevant folder. If a program has it's path hard-coded in then it won't get redirected.

– DMA57361 – 2010-08-20T17:27:32.680

@DMA57361: I opened a 32-bit Command Prompt, cded to C:\Windows\System32, then wrote a file. Then, I used 64-bit Windows Explorer to navigate to C:\Windows\System32. The file wasn't there. I then navigated to C:\Windows\SysWOW64. The file was in there. Windows 7 Ultimate 64-bit. – Hello71 – 2010-08-27T15:41:55.900

@Hello Same here. Very interesting, but we can't rely on the behaviour of elements provided as part of the OS to work the same as a "normal" program, there might be additional magic in them to ensure compatibility. What we really need to is to build a simple program that simply checks for a file in system32 (that doesn't appear in syswow64, possible created), compile to both 32 and 64 bits versions, and then see what happens. – DMA57361 – 2010-08-27T16:38:41.790

@Hello, well it seems you are correct. I made a txt file in system32 and built a quick C++ app to read out it to console (using C:/windows/system32 hardcoded). Compiled as 32bit it did not find the file, compiled 64bit and it does. – DMA57361 – 2010-08-27T17:14:24.037

4

Like @DMA57361 said, on Windows Vista x64, Program Files is where x64 software is installed, and Program Files (x86) is where x86 software is installed.

Windows (x64 versions) categorizes software this way due to a feature (for the Windows Installer Installation Cotext) called Folder redirection. Windows (x64 versions) have this feature probably beacause that's the way they can still support and categorize x86 applications.

About the second question, the "C:\ProgramData" is a folder that stores user related information that is shared by all accounts.

Mario

Posted 2010-08-20T09:23:11.017

Reputation: 246

Good link. I've run out of votes for today, but I'll try to remember to come back and give you a +1 tomorrow! – DMA57361 – 2010-08-20T17:30:58.520