Windows XP environment variable editor replacement that handles lines

5

1

I'm looking for an environment variable editor that handles linebreaks well. I have a monster %PATH% to edit (edited to save side-scrolling):

C:\Program Files\Windows Resource Kits\Tools\;C:\Program Files\PC Connectivity
Solution\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
C:\cygwin\bin;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;C:\WINDOWS
\system32\WindowsPowerShell\v1.0\;C:\Utils;C:\Program Files\Microsoft SQL 
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;
C:\Program Files\MKVtoolnix;C:\Program Files\Common Files\Roxio Shared\
DLLShared;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

I want the editor to put each path in a line and when I click save & close, for the editor put the lines back in the right format.

Is there an editor that can do that?

Codism

Posted 2009-12-03T16:29:59.650

Reputation: 845

Answers

8

Try out Rapid Environment Editor

alt text

Or based on Dominic's idea:
open up vim

:r !path
:%s/;/\r/g

Fix up your path lines, adding or deleting or modifying them
(delete first blank line)

:%s/\n/;/g

Rook

Posted 2009-12-03T16:29:59.650

Reputation: 21 622

awesome, thanks. I had written my own, but that was years ago, and I didn't want to have to maintain mine anymore. – C Johnson – 2010-08-23T15:02:27.667

It's a nice tool! I especially like the feature to reorder paths by CTRL-DOWN/UP. Thanks – None – 2009-12-03T17:29:58.430

0

If this is inside a batch file, you can split the path up into multiple lines like so:

set PATH=C:\Program Files\Windows Resource Kits\Tools\
set PATH=%PATH%;C:\Program Files\PC Connectivity Solution\
set PATH=%PATH%;%SystemRoot%\system32
set PATH=%PATH%;%SystemRoot%
set PATH=%PATH%;%SystemRoot%\System32\Wbem
set PATH=%PATH%;C:\cygwin\bin
set PATH=%PATH%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin
set PATH=%PATH%;C:\WINDOWS\system32\WindowsPowerShell\v1.0\
set PATH=%PATH%;C:\Utils
set PATH=%PATH%;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
set PATH=%PATH%;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\
set PATH=%PATH%;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell Common7\IDE\
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\
set PATH=%PATH%;C:\Program Files\MKVtoolnix
set PATH=%PATH%;C:\Program Files\Common Files\Roxio Shared\DLLShared
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

Also, as a side note, I've had problems running JBoss when the PATH contains items that end in backslash. Suggest you avoid the ending backslash on each path item to avoid issues.

Chris Nava

Posted 2009-12-03T16:29:59.650

Reputation: 7 009

0

I found Environment Variable Editor on codeplex that does the job.

chepseskaf

Posted 2009-12-03T16:29:59.650

Reputation: 269

0

Right click on My Computer > Advanced System Settings (or similar) > Advanced Tab > Environment Variables.

You'll have to do one at a time though.

Alternatively, using CMD you can use the set command to change/add environment variables. You could probably create a script to do this for you, calling the set.exe from a program or batch file.

C:\Users\Callum>set /?
Displays, sets, or removes cmd.exe environment variables.

SET [variable=[string]]

variable  Specifies the environment-variable name.
string    Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

You may also wish to read this and kb Q 104011:

Windows stores the environment variables in the registry under 
HKEY_CURRENT_USER\Environment (for user environment variables) and 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Environment 
(system environment variables). See also kb Q 104011.

Callum Rogers

Posted 2009-12-03T16:29:59.650

Reputation: 647

1That's a single line edit box, which is exactly his problem. – Dominic Rodger – 2009-12-03T16:37:26.650

0

You could always write out a new file, splitting on ; and writing out each component to a new line. Edit in your favourite editor, then join the lines back together with a ;.

You'd just need to write two tiny little utilities.

Dominic Rodger

Posted 2009-12-03T16:29:59.650

Reputation: 249

Splitting at ; doesn't work in the general case. Consider a PATH like C:\Windows;"C:\My Folder with ; in its name";C:\Program Files\foo;... – Joey – 2009-12-03T16:41:47.040

Darn. Good point. – Dominic Rodger – 2009-12-03T16:42:17.017

It will still work in most cases. Just how often do you see ";" in a folder name. – Rook – 2009-12-03T17:21:03.053

Oh, I do have such folders. But then again, I regularly break programs with my home path (which includes spaces and an umlaut :-)). – Joey – 2009-12-03T22:25:19.380

1Yeah, well ... I would have such problems too, if were using my home language. But I do not, so i don't. Let's face it ... in today's computer industry, english is the only language. – Rook – 2009-12-04T17:02:03.150