Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on re-arranging a number of the shell folders in windows 7 to utilize Dropbox to keep a set of machines in sync.

I'd like to create a .reg file which I can use to update the locations of these folders rather than manually changing them from the UI, but I don't want to rely on the path to the home folder being the same each time.

So my question is, is it possible to replace the REG_SZ values in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders with REG_EXPAND_SZ values specifying an offset from %HOME% instead of an exact path?

share|improve this question
up vote 1 down vote accepted

Gah, ignore the rest of this answer. The registry key you have there is useless. It won't change anything with your shell folders. Heck, there is even a value there:

alt text

You see, The reason that that key existed and shell folder locations were stored in the registry is that they initially were stored there. But since there was a documented way to get at them this was an implementation detail. Explorer might still update those values for you as a convenience since a great many applications are incorrectly relying on that key but you should never use it, anyway. Back to the topic, since this is just a static list reflecting (or not) what Explorer stores elsewhere changes there won't affect the systen in any way. Explorer simply doesn't care about it. Image you write where you are on a slip of paper every time you go somewhere. Do you magically pop up in another location when someone else writes on that paper?

As for REG_SZ to REG_EXPAND_SZ: Try it, but don't assume that it will magically work. The registry itself doesn't care about REG_SZ and REG_EXPAND_SZ–that's all done by the application reading the data. And since this value is a REG_SZ I'm guessing that you can't just replace it with REG_EXPAND_SZ and have it work.

share|improve this answer

Just a suggestion:

Instead of writing an adaptable .reg file, why don't you write a .bat file instead?
The .bat file can use environment variables, as well as change the registry.

See the following articles:

Managing the Windows Registry from the Command Prompt with Reg.exe
Batch files - Use REGEDIT to add, read or delete registry values

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .