Windows – How to add a folder containing a semicolon to the Windows PATH

environment-variablesescape-characterspathwindows

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?

Best Answer

Using double quotes works for me:

SET PATH=%PATH%;"C:\main() {printf('%d', 42);}"
Related Question