SEARCH

How-To Geek

Why Does 64-Bit Windows Need a Separate “Program Files (x86)” Folder?

If you’re currently using any 64-bit version of Windows you may have noticed there are two “Program Files” folders, one for 64-bit and one for 32-bit apps. Why does Windows need to sub-divide them? Read on to see why.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites.

The Question

SuperUser reader Stephen Jennings noticed the “Program Files” division and wanted to get to the bottom of things:

I know that on a 64-bit version of Windows the “Program Files” folder is for 64-bit programs and the “Program Files (x86)” folder is for 32-bit programs, but why is this even necessary?

By “necessary”, I don’t mean “why could Microsoft not have made any other design decisions?” because of course they could have. Rather, I mean, “why, given the current design of 64-bit Windows, must 32-bit programs have a separate top-level folder from 64-bit programs?” Put another way, “what would go wrong if I somehow avoided the redirection mechanism and forced everything to install to the realC:\Program Files\?”

There are plenty of questions on Super User and elsewhere that assert “one is for 32-bit programs, one is for 64-bit programs”, but none that I can find give the reason. From my experience, it doesn’t seem to matter whether a 32-bit program is installed in the correct place or not.

Does Windows somehow present itself differently to a program running out of “Program Files (x86)”? Is there a description that shows exactly what’s different for a program installed in “Program Files (x86)” instead of “Program Files”? I think it’s unlikely that Microsoft would introduce a new folder without a legitimate technical reason.

It’s true there are plenty of explainer articles focused on the difference between the two–such as our treatment of the subject here–but why exactly does Windows sport dual folders?

The Answers

If you’re looking for the short and sweet answer, turn to SuperUser contributor David Schwartz:

Short answer: To ensure legacy 32-bit applications continue to work the same way they used to without imposing ugly rules on 64-bit applications that would create a permanent mess.

It is not necessary. It’s just more convenient than other possible solutions such as requiring every application to create its own way to separate 32-bit DLLs and executables from 64-bit DLLs and executables.

The main reason is to make 32-bit applications that don’t even know 64-bit systems exist “just work”, even if 64-bit DLLs are installed in places the applications might look. A 32-bit application won’t be able to load a 64-bit DLL, so a method was needed to ensure that a 32-bit application (that might pre-date 64-bit systems and thus have no idea 64-bit files even exist) wouldn’t find a 64-bit DLL, try to load it, fail, and then generate an error message.

The simplest solution to this is consistently separate directories. Really the only alternative is to require every 64-bit application to “hide” its executable files somewhere a 32-bit application wouldn’t look, such as a bin64 directory inside that application. But that would impose permanent ugliness on 64-bit systems just to support legacy applications.

Another contributor, Oliver Salzburg, delves into the programming side of things and why exactly Microsoft would go about structuring the folders as they did:

After looking at this answer and comment thread the next day, I realize a possible major oversight in my answer. I falsely assumed a programming background and when I was talking about you in my comments, I didn’t mean the user, but the programmer.

I don’t work for Microsoft and I have no clue what the real reasoning behind these folders is, but I think the reason to have these folders is so obvious that I have no problem arguing it.

So let’s break it down!

  1. Folders are awesome!Let’s agree on something. Folders are great! We don’t need them, we have enough possible file names to put every single file on the root of your hard drive, so why have folders at all?Well, they help us order our stuff. And ordering stuff is great. It helps us to process things more easily. This is especially useful when working with a machine that requires structure.
  2. Separating data and logic is great!A paradigm often found in programming, is to separate data from logic. You want one part thatknows how to do something and you want another part you can do something with.This is also found in the file system.

    We have folders for application (logic) and folders for our valuables (data):

    Logic

    • %WINDIR%
    • %PROGRAMFILES%
    • %PROGRAMFILES(x86)%

    Data

    • %PROGRAMDATA%
    • %HOMEDRIVE%%HOMEPATH%

    So, it seems like folders are awesome and it makes sense to put programs in their own little folder. But why have 2? Why not let the installer handle that and put everything into one Programsfolder?

  3. Installers aren’t magicToday, we often use small programs to install our larger programs. We call these small programsinstallers.Installers aren’t magic. They have to be written by programmers and are applications (with possible bugs) like any other application out there. So let’s look at the situation an imaginary programmer would have to face with and without the current system:

    1 Program Files folder

    The developer maintains 2 installers. One for the 32bit and one for the 64bit version of his application. The 32bit installer will write to C:\Program Files\App\ and the 64bit installer will write to C:\Program Files\App\sixtyfour\.

    2 Program Files folders

    The developer maintains 1 installer. The installer will always write to %PROGRAMFILES% and depend on the operating system to expand the path accordingly (you actually don’t use environment variables for these cases, you’d use SHGetKnownFolderPath with FOLDERID_ProgramFiles to retrieve the correct path).
    Everything finds it’s place automatically and the pattern is identical with every application you install.

  4. Consistency makes senseWhen you learn something, that usually implies that an observed behavior was consistent. Otherwise there is really nothing to observe and learn.The same is true for our little file system. It makes sense to always put the same stuff into the same folders. That way, we’ll know where to look when we’re looking for something.

    The system for 32/64 application distinction furthers this goal. Applications are separated into 2 locations to avoid conflicts in names, binary loading behavior and security (to some extent).

I still don’t get it. This seems useless

You should never forget one thing. People are incredibly stupid. This includes users, super users and especially programmers.

This is why we need stuff like file system redirection to even make our systems usable.

Programmers will just go in there and try to load C:\Windows\system32\awesome.dll and not care about if they’re running on a 32 or 64 bit system. They would try to load the 64bit DLL and simply crash. Some programmers want to use some Office DLL, no problem, they know where to find it! C:\Program Files\Microsoft\Office\14.0\wizards.dll… and another crash!

All these requests by 32bit application are redirected into the 32bit counterparts to avoid application crashes.

We need some fixed folder names to build such a system. If there is no folder structure to support this redirection, then how are you going to make it work?

Okay, now I get it. But why not use C:\Program Files\x86\ then?

Now we’re getting philosophical…

What would go wrong if I somehow avoided the redirection mechanism and forced everything to install to the real C:\Program Files\?

Most likely nothing (as long as other applications don’t depend on a fixed location for that application).

The WOW64 mechanism hooks into CreateProcess and will perform more sophisticated (more sophisticated than checking the folder name of the executable) checks on the executable image to determine if it is 32 or 64 bit.

Yeah, but I mean, like, ALL applications!

  • What would happen if I put both diesel and gas into my car?
  • What would happen if I try to use both alternating and direct current on the same line?
  • What would happen if I keep both my cat and my fish in the same aquarium?

Some questions don’t require answers. It is not intended to be done, don’t do it. There is nothing to be gained here. The amount of problems such a change could cause will always outweigh any possible benefits someone could see in this.

For more responses and interesting insights into the programming decisions and logistics of structuring the folders, hit up the full discussion thread at SuperUser here.

 

 

Jason Fitzpatrick is warranty-voiding DIYer and all around geek. When he's not documenting mods and hacks he's doing his best to make sure a generation of college students graduate knowing they should put their pants on one leg at a time and go on to greatness, just like Bruce Dickinson. You can follow him on if you'd like.

  • Published 11/20/12

Comments (26)

  1. Raphael

    I have always admired how those with knowledge, give use peons; the answers that are short and simple to understand. Like a tire for a sub-compact car will not fit one of those Monster trucks.

  2. san

    I love this articles.

  3. grellanl

    The same app may be installed in both 32- and 64-bit versions, at the same time. This gives a way of ensuring they don’t overwrite each other with incompatible components.

    Why would you want to do that? Well, for a number of reasons. For example, your app might be a plugin or enhancement that works with other applications, and so needs to be installed in both 32 and 64-bit versions to support both program types.

  4. Traceman

    I love the analogy with this portion of the article “What would go wrong if I somehow avoided the redirection mechanism and forced everything to install to the real C:\Program Files\?

    Most likely nothing (as long as other applications don’t depend on a fixed location for that application).

    The WOW64 mechanism hooks into CreateProcess and will perform more sophisticated (more sophisticated than checking the folder name of the executable) checks on the executable image to determine if it is 32 or 64 bit.

    Yeah, but I mean, like, ALL applications!

    •What would happen if I put both diesel and gas into my car?
    •What would happen if I try to use both alternating and direct current on the same line?
    •What would happen if I keep both my cat and my fish in the same aquarium?
    Some questions don’t require answers. It is not intended to be done, don’t do it. There is nothing to be gained here. The amount of problems such a change could cause will always outweigh any possible benefits someone could see in this.”

    Yes, the WOW64 memory space would go nuts if we were to install a 32 bit application there. I am sure there are 32 bit memory spaces WOW32 for the 32 bit apps. It makes perfect sense to me. And, do not forget…..the registry would most likely go completely whacko with both 32/64 bit dll coexisting as well.

  5. FJMcNasty

    To keep path variables short I install all programs that allow the option into subfolders of C:\Win. If I have need for both x32 and x64 versions of the same program (eg Java RunTimes, Python ditto), then I install them separately into ProgFolder\x32\ and ProgFolder\x64\.

    Maybe I’m just anally stupid? Or stupidly anal. But I’ve never had any problems. Yet.

  6. Bob

    You folks are light years ahead of me. Here is a NGQ – Why won’t a 32 bit program (like a 32 bit photoshop elements) work on my Win7 62 bit? Is it the same issue as stated above with a small tire not fitting on a monster truck?

  7. Gary

    I can’t see the big deal. We don’t put chocolate milk in white milk cartons!

  8. Jim

    Thanks! It make sense.

    EXCEPT: Why didn’t Microsoft name the folder “Program Files (32)” or “Program Files (32bit)”?

    Why does “86″ really mean “32″?

    Who really cares that x86 architecture implies a 32-bit CPU?

  9. Gerard

    I have been putting all my programs on my D: drive in a folder called Program Files for a long time now. I have had no problems to date. That way I reduce the amount of data my C: drive.

  10. Josh

    If memory serves, the x86 came from in the days of the old 286, 386 machines, when os’s were custom built by the manufacturer. Feel free to correct this if I’m wrong

  11. Carbonhorse

    Huh.
    So when I created SSD-Program Files and SSD-Program Files (x86) files on a separate windows installation, to preserve limited space on my SSD drive. Windows foresaw my action, and treated these folders appropriately.

    That is why, every time I have re-installed a windows OS onto the disc drive.
    These folders have been kept in place.

    Program Files
    Program Files (x86)
    SSD-Program Files
    SSD-Program Files (x86)

    And not moved them to the windows.old folder.

    Clever people at Microsoft.

  12. williambaugh

    As a user, I don’t care if it’s 8, 16, 32 or 64 bit as long as it works.
    As a hobby programmer, I do care, the cpu is built to use preset codes and the program would have to be modified to work.
    I would have preferred a single folder \16\ and \32\ and \64\, soon there should be 128 bit cpu’s out there.

    Now if they would only figure a way to use freon to cool them instead of noisy fans.

  13. William Henry

    I have a full copy of Windows 7 Ultiimate however it is 32 bit, I have the capability of converting my computer to 64 bit by going into the computer setup. I have a friend who has the 64 bit version, will my licence work on either one? I don’t know whether it is an OEM but I understand that Windows usually comes with both versions. I purchased this disk at a computer show and the microsoft halographic is very noticable. The program installed and the licence was registered without any problems. Is there a way to tell whether a windows version is FULL vs OEM?

  14. mike

    Question actually a request.

    I would like to see an article that explains how to setup Windows 7 (32 and 64 bit) with one of these DOS emulators so that you can install DOOM or Earth siege from floppies and CDs so that they work. I keep an old XP laptop around that I can kludge to make this work, but it would be nice to be able to make Win7 work. Yes, I am a pack rat and I do have the original disks for DOOM etc.

  15. Jack

    I think you’ll have to do a new install to make it 64 bit, and as for as DOOM, why not just get an old computer and load dos or old windows on it and play the game.

  16. clamo

    BUT it doesn’t always work. SOME x86 programs are STILL incompatible and will NOT work.

    @mike: its not necessary for that as the 64bit version also is the 32bit version hence the x86, x86 is the 32 bit portion. but like jack stated…its best to build an old system for old games as they will run way better. Ive got an old Intel slot 1 P3 @800mhz set up with an old Geforce 3 or if I want an old 3DFX Voodoo 3 for games. and the old ass Soundblaster EMU 64. runs everything meant for win 98 and dos with about 1 gig of ram. easier to do that then mess with emulator configs that don’t support hardware emulation.

  17. Tania Biddle

    I’ve had such fun reading all these replys, but not understanding 1/2 of them. I’ve saved them to Pocket and will ponder at a later time.
    Thank you smart a…. so much

  18. Peter_s

    LoL!!!
    As a long term user of both DOS/Windows and Linux/OSX as well I feel so pleased to see what Windows folks are worries about.

    A Mac user usualy does not know nor need to know what makes the different between 32 / 64 Bit apps. OSX is the magic in the scene. It does all the stuff. Apps are nowaday universal binary for both 32 and 64 bit Intel (some even for PPC) machines. Frameworks serves the the apps with the needed underlying services and functions instead of several versions of DLL and so on (MS).
    Make it clever.

    This old MS crap can be overcome by leaving MS’s holy gral “compatibilty” once and for ever.
    Make a new clean OS and start over, leave the old crap.

  19. Kevin

    I’m still trying to figure out how 8 bit work.

  20. LadyFitzgerald

    I found the article interesting but didn’t think much about it until it dawned on me that it might explain why a post-it note program I had that worked great but would crash after a few days on Win7 64 bit (the roll-up function would get corrupted and the notes would have to be resized everytime I booted up). The program installer installs the program directly onto the C: drive instead of in a program folder. I’ve reinstalled the program, this time directing the installer to put it in the x86 folder. It’s been three days and a dozen reboots and, so far, it’s still working just fine.

  21. PoppaBear

    Not sure I understand all this, I just want to know how I can get a 32 bit VBNET application I have developed with 32 bit DLLs which I have also written (in C) to run on my 64 bit Windows 7 Home Premium laptop. I do not have an installation program just the executable and DLLs which all work
    fine on my XP machine. Do I just copy these files to the Program Files (x86) sub folder or is there something else involved ? Any help would be MUCH appreciated.

  22. Kapn Kevin

    Hello PoppaBear,
    If no one else has suggested, I will try placing the Files in the x86 Folder and set the EXE to launch in compatitbity mode Windows XP SP2.
    Let me know,
    Kapn Kevin
    dadrlz@gmail.com

  23. Potato

    What would happen if I keep both my cat and my fish in the same aquarium? <– you have a catfish.

  24. dugstratbear

    WOW! All of you are just joking, right? Right?!
    The first thing I did after a clean install of 64-bit Win 7 was make 2 folders on a separate hard drive; one named Games, one named Applications. All games (32-bit and 64-bit) in one folder; all apps (32-bit and 64-bit) in one folder.
    Name of folder and/or location has nothing to do with anything.
    I’ll bet everyone in these post are afraid to put two different kinds of food in your mouth at the same time, aren’t you?! :-)

  25. Cookie Monster

    Mr. Salzberg, while I understand your comment about all people being stupid and recent events seem to have proven this fact, I have found that all people are basically rather smart. They just happen to be talented in different areas. I would suggest that if you want your readers to give your comments more credibility that you find a better way to express yourself. You really do attract more attention with a serving of a bit of warm bread and honey rather than a cold serving of salt water tossed about.

  26. george monroe

    ok now how about some legacy hard ware drivers. 1 for Linux and Bsd and 0 for windows 7

Enter Your Email Here to Get Access for Free:

Go check your email!