How can I move or force a program installation to another location, even when unsupported?
I have an SSD as my main Windows drive, with a 640GB 2.5" HDD, partitioned to store programs and user settings, and also to act as backup (it's the only thing I had lying around at the time of building my PC).
The problem is that whenever I install a program, it installs to C:\Program Files [(x86 for the 32 bit programs]\
, although I have changed the environment variables.
This wouldn't normally be an issue, however every installation program points its shortcut to my 640GB HDD.
The root layout of both drives:
To clarify:
- Program files get installed to C:\
- Program shortcuts are always pointed to Z:\, my 640GB HDD
Modifying the relevant environment variables doesn't do anything, I looked at this, but however it only talks about modifying the registry and environment variables, which I have already done so.
I install to the Z:\ drive if the installation program lets me change the installation path, but however the installation programs sometimes don't let me change this.
Is there a way that I can force every program to install to the relevant location on Z:\, but at the same time move any programs currently installed to the new location? Perhaps I'm missing something here?
My target is to have every program installed on Z:/
, with only the core Windows operating system on C:/
.
Found this program; would it be appropriate to use in my case? I would be able to move the entire Program Files (and its x86 version) to Z:\, without impacting on the performance.*
System folders relocation
Is there a way that I can force every program to install to the relevant location on [a different drive or partition]?
Yes, there is. Keep in mind it's not officially supported, and can lead to unwanted side effects:
By changing the default location of the user profile directories or program data folders to a volume other than the system volume, you cannot service your Windows installation. Any updates, fixes, or service packs cannot be applied to the installation. We recommend that you do not change the location of the user profile directories or program data folders.
Source: Relocation of the Users directory and the ProgramData directory to a drive other than the drive that contains the Windows directory
Relocation of the "Users," "ProgramData," or "Program Files" directory is not supported in Windows 8 and will block operating system upgrades.
Source: You encounter an error when trying to install Windows 8.1 due to redirecting the Users or Program Files folder to another partition
Also:
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.
Source: Microsoft does not support changing the location of the Program Files folder by modifying the ProgramFilesDir registry value
If you understand that and want to continue anyway, make sure the destination is NTFS formatted, and that there's sufficient free space. Then follow these steps:
-
Select the Repair Your Computer option through the advanced boot options you get by pressing the F8 key before Windows starts. If the option is not available, you'll need to boot using a Windows installation disc.
-
Open the command prompt (also available by pressing Shift+F10), and retrieve the letter associated with the system drive by typing the following command and pressing Enter.
wmic logicaldisk get caption,filesystem,size,volumename
-
In case it doesn't exists already, create the destination folder. Replace the path below with the correct location.
md "X:\Program Files"
-
Copy all the data from the original folder to the new one. Replace
D:
with the letter of system drive you got in step 2, and then verify that all files were copied successfully.robocopy "D:\Program Files" "X:\Program Files" /copyall /xj /r:3 /w:10
-
Rename the original folder to something different, e.g.
Program Files.old
.ren "D:\Program Files" "Program Files.old"
-
Create a directory junction point pointing to the new folder location, adjusting the letters as needed.
mklink /j "D:\Program Files" "X:\Program Files"
Note The command will fail if the folder wasn't renamed, as per step 5.
-
Repeat steps 3-6 for any other folders you want to relocate. When you're done, restart Windows. Ensure everything is working correctly, then delete the
.old
folders.
Further reading
- Advanced startup options (including safe mode)
- Command-Line Reference
- NTFS junction point