A bug in TC's handling of parameters
Moderators: Hacker, petermad, Stefan2, white
A bug in TC's handling of parameters
For some reason the original bur report was moved to "not going to be changed" however this is a real bug in TC:
see http://www.ghisler.ch/board/viewtopic.php?t=12859 for more info.
To clarify using %T without %M causes the same behaviour i.e. the target path gets quoted incorrectly.
Cheers.
see http://www.ghisler.ch/board/viewtopic.php?t=12859 for more info.
To clarify using %T without %M causes the same behaviour i.e. the target path gets quoted incorrectly.
Cheers.
I cannot confirm that. Process Explorer shows the correctly transfered command line, also when %M is empty (cursor located on [..].
Looks like your test.exe treats the backslash, which is added by %T, as a masking char for the following quotation mark...
Output of test.exe:
Process Explorer:
Icfu
Looks like your test.exe treats the backslash, which is added by %T, as a masking char for the following quotation mark...
Output of test.exe:
Code: Select all
c:\test\test.exe
/X:C:\Program Files\program\dummy.exe
/L:C:\WINDOWS\TEMP\CMDCD9.tmp
/F:c:\path with spaces" /N:2 /C:1024
Code: Select all
"c:\test\test.exe" /X:"C:\Program Files\program\dummy.exe" /L:C:\WINDOWS\TEMP\CMDCD9.tmp /F:"c:\path with spaces\" /N:2 /C:1024
This account is for sale
Actually it's not my test.exe, it's the command interpreter of the console itself (command prompt) and since windows is probably not at fault it's how TC calls the process.
P.S. as you can see in the included code, test.exe does no manipulation of data in any way it simply reads the argv[], argv is filled by windows by following a specific set of commands, and is the standard.
P.P.S. But basically you're correct, the problem stems from the fact that TC ads \ to the category name but also quotes when needed, however \" is interpreted wrongly because it's an escape sequence which TC should render correctly - ie. \\" when needed.
Cheers.
P.S. as you can see in the included code, test.exe does no manipulation of data in any way it simply reads the argv[], argv is filled by windows by following a specific set of commands, and is the standard.
P.P.S. But basically you're correct, the problem stems from the fact that TC ads \ to the category name but also quotes when needed, however \" is interpreted wrongly because it's an escape sequence which TC should render correctly - ie. \\" when needed.
Cheers.
It's not the console which interprets backslash as a masking char but it's C.
If TC would send \\", this would mean that all languages which do NOT use backslash as escape char would have to deal with the additional junk char.
Example, simple batch:
output.cmd
Console output:
Icfu
If TC would send \\", this would mean that all languages which do NOT use backslash as escape char would have to deal with the additional junk char.
Example, simple batch:
Code: Select all
Command: %comspec% /k
Parameter: output.cmd %T%M
Code: Select all
echo %1
Code: Select all
"C:\path with spaces\\"
This account is for sale
Actually that's not what happens when %M is not set, try setting the parameter as and you'll see what I mean.
What I get is C:\Program when the path should be C:\Program Files\...
Cheers.
Code: Select all
output.cmd %T
What I get is C:\Program when the path should be C:\Program Files\...
Cheers.
2JackFoo
The quote problem seems to be the handling of the quotes in your short C program.
If I open cmd.exe and from there call your test program with parameter "C:\Path with spaces\",
it fails, too (without TC being involved):
While everything is OK using the batch version:
are included in the expression (%T%M), not for %T alone.
That is to make strings possible like "%Tfile.ext" or "C:\%M" - quotes around %T or %M would disturb here.
I couldn't find this info in the help (neither english or german) - did I overlook something
So for %T the name gets splitted into 2 parameters:
by changing the content of output.cmd to e.g. echo %* or
2icfu
The quote problem seems to be the handling of the quotes in your short C program.
If I open cmd.exe and from there call your test program with parameter "C:\Path with spaces\",
it fails, too (without TC being involved):
Code: Select all
C:\Path with spaces>paramtest_c.exe "C:\Path with spaces\"
paramtest_c.exe
C:\Path with spaces"
Code: Select all
C:\Path with spaces>paramtest.cmd "C:\Path with spaces\"
%0: paramtest.cmd
%1: "C:\Path with spaces\"
That is because TC only adds quotes, if both the directory and file nameWhat I get is C:\Program when the path should be C:\Program Files\...
are included in the expression (%T%M), not for %T alone.
That is to make strings possible like "%Tfile.ext" or "C:\%M" - quotes around %T or %M would disturb here.


So for %T the name gets splitted into 2 parameters:
- %1 = C:\Program
%2 = Files\
by changing the content of output.cmd to e.g. echo %* or
Code: Select all
echo %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
I'd basically agree - although it's quite weird, that the first backslash (\P) is treated as normal backslash, but the last one (\") as escape-sequence...It's not the console which interprets backslash as a masking char but it's C.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!
Here is more info about C command line parsing:I'd basically agree - although it's quite weird, that the first backslash (\P) is treated as normal backslash, but the last one (\") as escape-sequence...
http://msdn2.microsoft.com/en-us/library/ms880421.aspx
IcfuA double quotation mark preceded by a backslash, \", is interpreted as a literal double quotation mark (").
Backslashes are interpreted literally, unless they immediately precede a double quotation mark.
This account is for sale
2icfu
Weird, but standard...
Thanks for the link.
Wow, a bug built in by design.Here is more info about C command line parsing:
http://msdn2.microsoft.com/en-us/library/ms880421.aspx

Thanks for the link.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
-- TC starter menu: Fast yet descriptive command access!