1

I'm working on several Windows computers (mostly Win7) and like to carry my configuration around with me. That configuration is mostly development stuff, like: Where is the main Mercurial repo on my computer? Where are the JAR files? Where is Cygwin?

In order to decouple various tools and scripts from the exact location of such things, I point them to environment variables, which I then have to set up for each machine, of course.

As I maintain all my important configuration settings (like for Vim) in Mercurial, I'd like to put the environment variables there as well. In order for this to happen, I need a simple text file representation for editing that ideally I could import per double click into the registry, which is where Windows environment variables reside.

HKEY_CURRENT_USER\Environment
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

My first idea was of course to use regedit and just export the relevant keys to sys-env.reg and usr-env.reg. I would then be able to weed out the stuff I wouldn't need to edit, do the edits I want to do, and re-import the environement, and done.

And it works indeed. There's only one problem. A registry type value of REG_EXPAND_SZ is exported as an unreadable and uneditable text representation the underlying binary format (whatever it is).

Hence the question: Does anyone know a better text format for the purposes described above, notably editing? (If not, this is as good as it gets, and I'm already 90 % there, so it's good enough.)

Before you suggest that, I know about the excellent Rapid Environment Editor, and I'm actually using it a lot, but this is not what I'm looking for right here.

3
  • 1
    The underlying binary format is simply an Unicode string. It's encoded in hexadecimal in .reg files for backwards compatibility. Mar 4, 2012 at 15:50
  • 1
    Just FYI. Windows 7 comes with setx.exe to modify environment variables. Mar 4, 2012 at 16:02
  • @grawity - Thanks, it occurred to me after posting that it is a representation of a UTF-16 string. Still not convenient to edit, unless you've memorized (at least) the ASCII table. -- Oliver - Thanks, I'm aware of SETX, one of the former Resource Kit tools that now ship by default.
    – Lumi
    Mar 4, 2012 at 17:32

0

You must log in to answer this question.

Browse other questions tagged .