2
MVV
Despite cmd.exe's horrible rules with regard to command line arguments, the problem here is not with cmd.exe.
cmd.exe demands a string/file name to be quoted if it contains special characters such as the circumflex.
From cmd.exe's own documentation:
Code: Select all
The special characters that require quotes are:
<space>
&()[]{}^=;!'+,`~
And %P%N does not quote if a file/directory name contains a circumflex but no other special character, which is entirely and solely a problem with TC.
Look closely at the command line shown in TaskManager when you use a file name like "1^2.txt" for a %P%N argument in a toolbar button with a batch file:
Code: Select all
C:\Windows\system32\cmd.exe /c ""X:\test.cmd" X:\1^2.txt"
Note that the file path argument itself is not quoted, which is not correct.
It should rather have quotes around the file path like this:
Code: Select all
C:\Windows\system32\cmd.exe /c ""X:\test.cmd" "X:\1^2.txt""
Now compare this with a file name like "1&2.txt":
Code: Select all
C:\Windows\system32\cmd.exe /c ""X:\test.cmd" "X:\1&2.txt""
Note that this time the file name argument IS quoted.
Screenhot from my TaskManager process list showing toolbar button invocations once with 1^2.txt and once with 1&2.txt:
https://imgur.com/a/3evcvXR
You can actually get the the example with the file 1^2.txt kind of "working" by just surrounding %P%N with quotes in the button definition. This is of course not a feasible workaround due to %P%N auto-quoting paths where it deems it necessary (and unfortunately missing to look for "^"), but it will demonstrate that the problem indeed seems to be with TC.