Setting permanent environment variables on Windows via command line

Some of our internal tools at work require a number of environment variables to be set to a variety of different options, depending on the project. This can be done with set, but that only changes the value for the life of the command shell you run set in. If stand-alone apps require those environment variables, they need to be set for the system. I used to be resigned to doing this by going to the System settings (via Control Panel or a right-click on My Computer and selecting Properties), selecting Advanced Options and clicking the Environment Variables button. The variables can then either be edited one by one in a tedious multi-dialog process, or new ones added in an equally tedious process. This is especially irritating if, like me, you would prefer to use the keyboard for most tasks.

But now the drudgery has been lifted – I have found setenv.exe! This terrific little tool allows user and system env variables to be set at the command line – so setting or altering the variables now becomes a sequence of commands like

setenv.exe -m NAME VALUE

I have no idea who wrote this tool, but whoever you are, thank you, from the bottom of my heart.

EDIT: I know who wrote it now – many thanks to Vincent Fatica.

Leave a Comment

Filed under computing, Uncategorized, windows_tricks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.