Bill, may I ask what the goal of this exercise is and why you want to relocate these specific folders to another drive? Is it that you are running low on disk space on C:? I'm just curious to understand why you want to do this.
To my thinking, rather than making registry changes, I would think that creating a symbolic link might be far more liely to succeed. There are a couple of reasons for this:
1) There are likely to be hundreds, if not thousands of references to those folders in the registry, and I could imagine that getting everything might be a nearly impossible task.
2) By using a symbolic link, you would not need to change any registry settings, or any other program settings. Programs, the registry, etc. could still reference "C:\Program Files" for instance, but they would be directed to the location pointed to by the symbolic link, such as "D:\Program Files". In other words, this change would be transparant to the apps and to Windows.
Possible problems
First, let me note that this is something I have never tried. I'm simply throwing out possible ideas here. But, one of the big questions that I have is this: What happens if I create a symbolic link, in effect redirecting these folders to D:? As soon as you do that, everything will try to access that new location even before you get to move the data to that location. Will that cause an immediate problem? I have no idea.
This might take some more research and some testing. Some suggestions: If you have the ability to do so, consider testing this on a VM to see what happens. Also, I would stringly suggest making a disk image backup of the OS drive before you do so that you can easily revert back if this goes terribly wrong.
Maybe some others have thoughts on this topic that are far better than what I have, but I hope that this helps.
I wrote myself some notes a few years ago on ther topic of junctions, symbolic links, etc. Below is just a raw copy of those notes - maybe that will help to at least explain my thinking here.
------------------
Shortcuts, Symbolic Links, Hard Links, and Junctions
A shortcut is a file that points to another file. It is an antiquated pointing system from the Windows 95 era that many programs do not recognize. Shortcuts do not only use up space on the hard drive, but they also break and linger behind after the deletion, renaming or moving of the target.
A symbolic link is like a shortcut, but instead of being saved as a file it is registered to the hard drive partition. It does not use any disk space, and all programs recognize both the link and the target. A symbolic link can point to any file or folder either locally on the computer or over a network using an SMB path.
NOTE: What Windows calls a Symbolic Link is often referred to as a Soft Link.
A file hard link is a little different and cannot be used over multiple partitions meaning you cannot have a link on drive C: pointing to a file on drive D:. A file hard link points to and duplicates a target as a mirrored copy, but the duplicate does not use any additional space on the hard drive partition. So, two hard links that mirror a 1 GB file would in total only use 1 GB on the partition rather than 3 GB. Importantly if either the hard links or the target were deleted, the other links retain the data. Changes to the content of either the target or the links automatically propagate to all other items.
A junction behaves like a hard link for directories, but unlike file hard links you can create junctions that span multiple partitions. Again, a directory junction and its content are stored on the hard drive partition, but they do not use any additional space. Any changes to the content within either the target or the links will automatically propagate except where the target directory is deleted or renamed. In that case, all links that point to the target will break and linger on the partition.
--------------------
There is a difference between how Junctions, Symbolic Links and Volume Mountpoints are treated when performing file system operations such as move/copy etc. If you create a Symbolic Link, and you then move that link it is much the same as a shortcut in that it just moves the link itself, no actual data is moved/copied.
However, if you move a Junction or Volume Mountpoint, a new folder is created at the move destination point and the contents of the original data folder is physically moved from its source location to the new move location. The Junction or Volume Mountpoint remains where it was, and the source folder remains intact (it just becomes empty).
----------------------
Creating Symbolic Links (Symlinks) and Directory Junctions in Windows
To create a symbolic link, run the following command from an elevated command prompt:
mklink Link Target
For a directory (folder), use this syntax:
mklink /D Link Target
Example: You have a folder D:\MyFolder that you want to make visible as C:\MyFolder. Run this command:
Mklink /d C:\MyFolder D:\MyFolder
In this example, the TARGET is the location that already contains the data. Note that the LINK cannot already exist. When the mklink command is run, it will create the link.
To create a hard link for a file, use this syntax:
mklink /H Link Target
For a hard link to a directory (folder), also known as a directory junction, use this syntax:
mklink /J Link Target
IMPORTANT: The "Link" in a directory symbolic link or directory junction SHOULD NOT ALREADY EXIST when you run this command and the "Target" SHOULD already exist.
NOTE: If you are going to reference a location that has no drive letter or has a drive letter subject to change, for example, with removable media, you can reference the volume GUID. For example, \\?\Volume{01005fc0-799f-11e9-8145-001583eeba66}\. You can get the volume GUID by running the command "mountvol".
Example:
Using the example of the Plex desktop app which is hard coded to save downloaded media to the location %LOCALAPPDATA%\Plex\Plex Media Server\Sync\, let’s say we want to store this on D:\Plex Downloads. Create a directory junction like this:
mklink /J "%LOCALAPPDATA%\Plex\Plex Media Server\Sync\" "D:\Plex Downloads"
Now, even though Plex is hard coded to save downloaded media to "%LOCALAPPDATA%\Plex\Plex Media Server\Sync\", it will actually be stored on "D:\Plex Downloads".
To display all symbolic links and junction points
This command will display all symbolic links and junction points on C:\ and all subdirectories:
DIR /AL /S C:\
/A : Displays all files with a specific attribute
L: Specifies Reparse Points (symlinks and directory junctions)
/S: Recursive search to find files and folders in and within specified directory