3

It looks to me like folder redirection edits the following two registry keys to point folders to a different location:

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

First off, confused why its also editing Shell Folders? I thought that was ancient and "User Shell Folders" takes precedence anyway.

Is it actually just editing the registry keys directly and is it safe for me to edit those keys directly?

Also, if I'm manually editing it should I even bother editing Shell Folders if User Shell Folders takes precedence?

red888
  • 4,069
  • 16
  • 58
  • 104
  • 1
    To answer the part about writing the registry, it's always preferred to use policy rather than edit the registry directly. – Jim B Jan 30 '17 at 16:31
  • More concerned with _why_ I shouldn't be doing that (I know its a best practice). Or what could go wrong. Is all the policy doing editing these two reg keys or is there some other config it does that I'm missing? – red888 Jan 31 '17 at 04:27
  • 1
    Its undefined, as far as I can tell. Generally speaking MSFT doesnt publish what could go wrong doing things the wrong way. As an example why is this key possible in 2 places? Because that's how its written. We can make guesses and assumptions but that's it. – Jim B Jan 31 '17 at 10:18

1 Answers1

2

Folder redirection well documented at Technet

About registry keys precedence you can read:

The entries in this subkey can appear in both the Shell Folders subkey and the User Shell Folders and in both HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. The entries that appear in user User Shell Folders take precedence over those in Shell Folders. The entries that appear in HKEY_CURRENT_USER take precedence over those in HKEY_LOCAL_MACHINE.

About backwards compatibility: here writеen that Windows 2000 (and I believe later versions too - the document is quite oldnever) don't use "Shell Folders" keys - its made for NT 4 compability. The old documentation for developers I've met a warning not to use "Shell Folders" keys. Now, this documentation no longer available on MSDN.

In my Windows 10 installation there registry key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\!Do not use this registry key with value: "Use the SHGetFolderPath or SHGetKnownFolderPath function instead"

Additional intresting reading about topic in really old blog post.

Slipeer
  • 3,255
  • 2
  • 18
  • 32
  • 1
    no its not, at least to the level of detail I'm asking for. The word "registry" doesn't appear once in that article. I know what folder redirection does, I want to know how it is doing it. Also, I know how the precedence works, again my question is why the policy sets both of the keys. Just because? Way way backwards compatibility? Or is it actually necessary for the folder redirection feature to function correctly – red888 Jan 31 '17 at 04:32
  • I'm update my answer. – Slipeer Feb 02 '17 at 08:44