Search code examples
windowssystemclasspath

How to manage PATH variable in Windows?


Every time I experiment with a new language, compiler, interpreter, tool, or whatever, and I want to run that from the command line, I would have to go to System and change my PATH variable. However, the box to put the monster string in consists of only a 1-line text box. I frequently find myself having to copy/paste the PATH string into Notepad just to edit it -- It's already over half a page. Right now I've counted about 30 different path URL's.

Is there a better way to manage paths than to squeeze all of them into one string? I'm thinking of using SUSE for development since my PATH is so messed up.


Solution

  • If you always start the command line from one or a few shortcuts, you can run a batch file when it starts. For example:

    cmd /k autoexec_console.cmd
    

    where the batch file could have

    set path=c:\foo;%path%
    

    or anything else, and this would persist only for that cmd.exe instance.


    XP's Service Pack 2 Support tools (looks like there's one for SP3, but it doesn't say what's in it) comes with a program setx.exe that works like a permanent set.