views:

84

answers:

1

I am curious if there is any history behind why the ^ character is used to escape the special characters <, >, |, &, and ^ in environment variable names in Windows instead the \ character that is typically used to escape special characters.

Please note that I realize there may be no reason for this, but I'd be interested to hear if there is a reason.

+3  A: 

'\' is the character typically used to escape special characters on Unix systems (or the language C, or any language inspired by C). Which is handy, because it's more or less the only use of that character in those systems / languages.

Windows, on the other hand, comes from a CP/M heritage, which uses '\' as path delimiter. Having to escape the path delimiter on each occurence would be a bit awkward, and I guess (!!) that's why they chose a different escape character.

DevSolar
That would make sense, thanks.
bde
CP/M didn't have directories, so the issue of what to use as the path separator didn't come up. It used '/' for command-line options, and so did MS-DOS 1.0. When MS-DOS 2.0 added support for a directory tree, backwards compatibility constraints prevented using '/' for the path delimiter, so it chose '\' instead.
dan04
...and we've been suffering every since.
siride