%P%S double double quote

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Hurdet
Power Member
Power Member
Posts: 716
Joined: 2003-05-10, 18:02 UTC

%P%S double double quote

Post by *Hurdet »

I have:
param="alfa txt "%P%N" beta"
that produce
"alfa txt ""namefile.ext"" beta"
but if is %P%S it not work.
how to solve?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50930
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

%P%S adds double quotes automatically when needed (only when the specific path and file name contains a space). Therefore please do not put double quotes around it yourself.
Author of Total Commander
https://www.ghisler.com
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

TC's %P%S is broken, as it will not allow you to manually add quotes.

Any Files that use special characters will break most Batch scripts
e.g.

File(Test).txt
File&Test.txt

There's probably a few other characters that will completely break batch scripts if the string isn't encapsulated in "quotes" as well.

The only way to do it, is to
1) Pass the file names to something like AHK first, so it can parse all the names and quote them if they are missing quotes --- and then pass that to the batch script.
2) Use %L instead - but then yer writing to the disk for little purpose.
3) Don't use batch anymore, TC doesn't support it properly.

For years myself and others have asked to be allowed to either manually quote TC's internal variables like %P%S or to FORCE quoting - whether TC thinks its needed or not. To no avail.
Post Reply