Wow, I totally missed the introduction of SETX.
From TechNet:
SETX:
Creates or modifies environment variables in the user or system environment, without requiring programming or scripting. The Setx command also retrieves the values of registry keys and writes them to text files.
Even better, is that it allows you take values from these sources so it is easy to get those into environment variables:
- Command-line parameter
- Registry key
- Text file (with some filtering/search options)
From a bit of searching around, I think it got introduced in a Windows Resource Kit, and got included by default starting Windows Vista.
Excellent addition to my toolset (:
–jeroen
via Setx.