Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I noticed that the semicolon ; is a valid character for Windows (NTFS) file and directory names.

The semicolon is, however, used as element delimiter for the PATH environment variable.

Say I have a folder called C:\"main() {printf('%d', 42);}" (heh, nice, also contains a percent sign) -- how could I add this folder to the system PATH?

share|improve this question
    
Avoid using semicolons in folder names, then you won't have a problem! –  Lee Taylor Apr 19 '13 at 10:08
    
Well, you should be in control of folders that you're adding to PATH. It seems odd that you'd have folders with semicolons, etc. in them. –  Lee Taylor Apr 19 '13 at 10:22
add comment

2 Answers

Get the folder short name via DIR /X, then add that short name to the PATH. It seems that PATH is OK with % sign though

share|improve this answer
    
Bah. Short-Names. But, yes, indeed, this appears to be a possible solution iff one is able to determine the short name. –  Martin Apr 19 '13 at 10:06
1  
So you mean how would you add if the user disabled the short name generation? support.microsoft.com/kb/121007 –  Martheen Cahya Paulo Apr 19 '13 at 10:17
1  
Either by creating a junction point or symbolic link with simple name and adding it to the PATH then. –  Martheen Cahya Paulo Apr 19 '13 at 10:22
add comment

Using double quotes works for me:

SET PATH=%PATH%;"C:\main() {printf('%d', 42);}"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.