Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Quoting file names with special characters?

May
12,845
164
I don't know if this is a good idea or not.

What if "DO f in ... fileset ( ... )" were to automatically quote %f when it contains special characters?
 
That was the original behavior. And then the beta testers (that would be you!) complained that the auto-quoting made it difficult to pass the returned value on to other functions / commands.
That doesn't sound like me, but in any case ...

Commands will certainly have a problem if an unquoted file name contains special characters. What about variable functions? Are there ones that expect/require a file name but won't work correctly if it's quoted?
 
Vince - sounds like this waas from my thread with you..... :)
 
That doesn't sound like me, but in any case ...

Commands will certainly have a problem if an unquoted file name contains special characters. What about variable functions? Are there ones that expect/require a file name but won't work correctly if it's quoted?
Not just "special" characters, but directories with spaces. I installed V22 in a directory named "TCMD V22" and that has necessitated changes to many of my scripts.
The DO loops where especially troublesome until I read the docs more carefully. Quoting the resulting variable has solved that and works quit well so far.

I haven't encountered any problems using quotes in variable functions yet, have you?
 
I haven't encountered any problems using quotes in variable functions yet, have you?
Not in functions that expect a file name (but I didn't do an exhaustive search). As expected, generic string functions (like @LEN) treat the quotes as significant.
 
Not in functions that expect a file name (but I didn't do an exhaustive search). As expected, generic string functions (like @LEN) treat the quotes as significant.
That's a very good argument for not having DO arguments automatically quoted.
For example;
Code:
v22.00.31_$*echo %_cmdspec
D:\TCMD v22\TCC.EXE

v22.00.31_$do var in "%_cmdspec" (echo %var & echo %@len[%var])
D:\TCMD v22\tcc.exe
19

v22.00.31_$do var in /L %_cmdspec (echo %var & echo %@len[%var])
D:\TCMD
7
v22\TCC.EXE
11

v22.00.31_$do var in /t"" /L %_cmdspec (echo %var & echo %@len[%var])
D:\TCMD v22\TCC.EXE
19
Not an extensive example, but it does illustrate the point. I have scripts and aliases that use other variable functions, some needing quotes and some not. Just have to be careful of the intended use and quote where required for a correct result.
Perhaps someone would like to invest the time to write an exhaustive btm to test all the permutations. Considering the extensive number of variables and functions in TCC this could be a very time consuming exercise or not. :rolleyes:
 

Similar threads

Back
Top