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?
%P%S double double quote
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50930
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
%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
https://www.ghisler.com
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
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.
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.