Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do Windows environment variable names use a special escape character?

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.

like image 456
WildCrustacean Avatar asked Apr 19 '10 13:04

WildCrustacean


1 Answers

'\' 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. (Edit: Not quite correct, see comment below.) 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.

like image 131
DevSolar Avatar answered Sep 22 '22 16:09

DevSolar