%O parameter doesn't quote filenames with spaces

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Rekrul
Junior Member
Junior Member
Posts: 69
Joined: 2007-11-04, 21:40 UTC

%O parameter doesn't quote filenames with spaces

Post by *Rekrul »

Well, this certainly seems like a bug, and I couldn't find anything about in the documentation, but I'll probably be told that it's working the way it was intended...

The help files says that the parameter %N inserts the selected filename, and that %O inserts the selected filename without the extension.

Let's say that you have a file called My Book Report.txt

%N = "My Book Report.txt"

%O = My

Yes, you can avoid this by enclosing %O in quotes yourself, but why do you have to?

If this is the intended behavior, can someone please describe to me a scenario where you would only want the first word of a filename containing spaces that isn't a completely obscure and unique one-off case?
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: %O parameter doesn't quote filenames with spaces

Post by *Sir_SiLvA »

Rekrul wrote: 2024-01-23, 12:32 UTC Let's say that you have a file called My Book Report.txt

%N = "My Book Report.txt"

%O = My
Wrong :!:
%O = My Book Report

You just have a default behaviour that another program that gets My Book Report split it by spaces if you dont use quotes :!:
Rekrul wrote: 2024-01-23, 12:32 UTC Yes, you can avoid this by enclosing %O in quotes yourself, but why do you have to?
Because contrary to you programs cant think :D
Hoecker sie sind raus!
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: %O parameter doesn't quote filenames with spaces

Post by *Fla$her »

Rekrul wrote: 2024-01-23, 12:32 UTC Yes, you can avoid this by enclosing %O in quotes yourself, but why do you have to?
"new text %O new text.%E"
Need more explanations? :)
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: %O parameter doesn't quote filenames with spaces

Post by *ghisler(Author) »

TC does not add quotes around most parameters like %O because they are often combined with others, e.g. the user could write %O_copy.%E or so.
Quotes are added for %N, %P%%N, %T, %T%M and a few others. User %Q at the start to turn off automatic quotes.
Currently it's not planned to add automatic quotes to more placeholders, sorry.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: %O parameter doesn't quote filenames with spaces

Post by *petermad »

Moderator message from: petermad » 2024-01-23, 19:24 UTC

Moved to "TC Behaviour which will not be changed" from "TC11.x bug reports (English)"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Rekrul
Junior Member
Junior Member
Posts: 69
Joined: 2007-11-04, 21:40 UTC

Re: %O parameter doesn't quote filenames with spaces

Post by *Rekrul »

Sir_SiLvA wrote: 2024-01-23, 13:36 UTC Wrong :!:
%O = My Book Report

You just have a default behaviour that another program that gets My Book Report split it by spaces if you dont use quotes :!:
You mean virtually every Windows program in existence?

While there may be some programs that will accept a filename with spaces in it that isn't quoted, the vast majority will interpret space as a delimiter and stop reading a filename there. Can you name a common Windows program that accepts filenames on the command line, which doesn't need filenames with spaces to be enclosed in quotes?
ghisler(Author) wrote: 2024-01-23, 14:26 UTC TC does not add quotes around most parameters like %O because they are often combined with others, e.g. the user could write %O_copy.%E or so.
Quotes are added for %N, %P%%N, %T, %T%M and a few others. User %Q at the start to turn off automatic quotes.
Currently it's not planned to add automatic quotes to more placeholders, sorry.
Thank you for the explanation. May I respectfully suggest that the help file should make it clear which parameters will be enclosed in quotes and which won't be? I'm not suggesting that it be stated in the description for each and every parameter, maybe just a note at the top like "Please note, only the following parameters will be enclosed in quotes if they contains spaces, all others you will have to enclose in quotes yourself: %N, %P%N, %T, %T%M..."
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: %O parameter doesn't quote filenames with spaces

Post by *Dalai »

Rekrul wrote: 2024-01-24, 00:37 UTCMay I respectfully suggest that the help file should make it clear which parameters will be enclosed in quotes and which won't be?
I agree that this piece of information should be available in the TC help. Support++
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply