Set Windows Environment variables from the registry (TCC/LE)

Thu 30 September 2010
By stu

[EDIT: 2010/10/05]

Oops, I've been using TCC/LE by JPSoft as my shell... the following doesn't work in the normal command prompt

[/EDIT]

I just had a look at SET and it lets you set user/system variables:

Display, create, modify, or delete environment variables.

SET [/A /D /E /P /R file... /S /U /V /X] [name[=][value ]]
        file:  One or more files containing variable definitions
        /A(rithmetic)           /S(ystem variables)
        /D(efault variables)    /U(ser variables)
        /E(nv vars)             /V(olatile variables)
        /R(ead from file)       /X override VariableExclude
        /P(ause)

So to set save a variables MYAPP_HOME as the current directory, just do

SET /U MYAPP_HOME=%CD

Wish I'd have looked that up a few years ago, it'll save a few seconds next time I need to setup some dev sdk :)