How can I change the default program installation directory in Windows 7?

4

3

Windows 7 is installed on my C drive, which is quite small. I am very tired of instructing new programs to put their files on my larger D drive during installation; I would like to change the default drive.

This article says that you can use a registry hack, but I am giving Microsoft the benefit of the doubt and naively assuming that a configuration option exists somewhere. It's 2010... do I really have to hack my registry to make a simple tweak like this?

Also, there's a ServerFault question that explains how to move the "Users" directory and create a symlink, which could also work. However, at the moment I have some apps in C:\Program Files, some apps in C:\Program Files (x86), and some apps in the corresponding folders on D:\, so it would be a hassle.

Also, my small OS boot drive is a 10k RPM WD Raptor, and I feel like that probably gives a speed boost to apps installed on it that need to read & write to their directories a bunch. I wonder if it actually matters.

Max Cantor

Posted 2010-09-06T21:55:26.067

Reputation: 436

Please note that you should keep ProgFiles and ProgFiles(x86) seperate (so don't try and symlink them in to one place, for example) see "C:\Program Files" on Windows Vista+ (x64). Also, most programs do not write to thier own directories (or rather shouldn't), they should use ProgramData or Users\<un>\AppData instead. So you could install elsewhere and keep these on C for speed.

– DMA57361 – 2010-09-07T13:51:41.477

@DMA57361 - I'm actually strangely irked by the Users\<un>\AppData behavior; I feel like that should live on my bigger/slow drive, too. Some apps are disk space hogs, so I'd rather just not have to worry about whether one of them is sucking down space! Thanks for the warning on (x86). – Max Cantor – 2010-09-07T20:34:31.280

1no problem. If you want to go a little over-the-top, why not just symlink the "space hogging" subfolders and leave whichever other you wish to on C - just remember that Users\<un>\AppData will exist for each user, and ProgramData should be used for "shared" bits. How each program really works is another matter, of course. – DMA57361 – 2010-09-08T07:19:39.533

Answers

8

There is no way to set the default program installation folder in Windows other than that registry change. If you're on a 64-bit system, then you should follow the instructions given here.

After all, Microsoft does not support changing the location of the Program Files folder by modifying the ProgramFilesDir registry value.

Microsoft does not support changing the location of the Program Files folder by modifying the ProgramFilesDir registry value. If you change the location of the Program Files folder, you may experience problems with some Microsoft programs or with some software updates.

Mehper C. Palavuzlar

Posted 2010-09-06T21:55:26.067

Reputation: 51 093

I changed it some years ago and I never had problems with it. Windows Updates never failed but you're right: Windows doesn't test this case and thus might not work correctly – BlueWizard – 2015-10-23T05:30:22.200

Glad I read this answer before I followed the advice given by Microsoft Support.

– Matt – 2019-09-28T13:42:11.123

4

From Raymond Chen:

Why can't I move the Program Files directory via the unattend file?

The unattend file lets you change some Windows configuration settings that cannot be changed after Setup is complete. But one of the things you can't change is the location of the Program Files directory. Many people wish they could relocate their Program Files directory to another drive in order to relieve disk space pressure on the system partition. Why won't Windows let them do this?

Windows Setup takes advantage of hard links. A large percentage of the files installed by Windows are hard-linked to copies in the C:\Windows\WinSxS directory.

But one of the limitations of hard links is that they cannot span volumes. Some of the hard links out of the WinSxS directory point into places like C:\Program Files\Windows NT\Accessories\wordpad.exe, and this in turn requires that the Program Files directory be on the same volume as your Windows directory.

Sorry for the inconvenience.

tl;dr: Windows cannot run with Program Files on any other drive

dm;hs

Ian Boyd

Posted 2010-09-06T21:55:26.067

Reputation: 18 244

0

I know this question is a bit old but you actually are able to change the default installation folder.
It won't move your currently installed programs to that place but install wizards you use in future will use these values as their default path.

The keys for the default folder are stored in the registry at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

You'll be able to see two subkeys
ProgramFilesDir
ProgramFilesDir (x86)

The first is for your 64 bit applications. (C:\Program Files)
The second for your 32 bit applications. (C:\Program Files (x86))
I don't think that they need to be diffrent.

Please be aware that you still need the C:\Program Files\ Folder and that you can't just copy and baste from C:\ to D:\
To move software between the old Folder and the new one you need to uninstall the software and then reinstall it on the new path.
Some programs won't ask where to install themself and they'll probably stick to C:\Program Files\

I changed these settings a while abo and it works fine.
There are some installers who don't care about the registry entry but the most common installers use these values as their default.

How do I change these values?

Method 1
You can change these values by opening regedit.exe via start menu or cmd and browse to the entries. How do I do this?

Method 2
And here's some selfpromotion:
I wrote a small c# open source program to change these two registry values
See it on GitHub (binary download available)

Method 3
You can also download a .reg file which will change the entries for you. Download the .reg file and change the values in an Text Editor (such as Notepad++). Then just click on it and the Job is done.
Download the .reg file

You don't get it?
Read this article which explains the registry
(Alternatively just google)

BlueWizard

Posted 2010-09-06T21:55:26.067

Reputation: 298