Escaping %’s in file-/folder-names at the command-line [duplicate]
Something odd happened to me when I tested this.
dir "C:\Program Files\^%temp^%"
For some reason, it appears the quotes interfere with the escaping. If I escape the quotes too, it works.
dir ^"C:\Program Files\^%temp^%^"
It looks ugly, but it works.
If there are no spaces in the path, the quotes are not necessary at all.