backticks and quotes and @LEFT (v8 vs. v9 & v11)

Feb 17, 2010
3
0
I've looked around a little bit for solutions to this, but didn't find anything obvious. I only use the 4nt console if that matters and I've tested with these versions:

4NT 8.02.94 Windows XP [Version 5.1.2600]
4NT Build 94 Windows XP Build 2600 Service Pack 2
---
TCC 9.02.154 Windows XP [Version 5.1.2600]
TCC Build 154 Windows XP Build 2600 Service Pack 3
---
TCC LE 11.00.40 Windows XP [Version 5.1.2600]
TCC LE Build 40 Windows XP Build 2600 Service Pack 3

The below batch file works in v8 with all 4 test cases.

test.bat
Code:
@ECHO OFF
IFF %@LEFT[1,%*] EQ %@CHAR[34] THEN
ECHO Got a quoted string
ENDIFF

Here is how v8 responds and I would think is expected:
Code:
c:\>test string

c:\>test "string"
Got quoted string

c:\>test `string`

c:\>test `"string"`
Got quoted string

Here is how v9, etc responds:
Code:
c:\>test string

c:\>test "string"
Got quoted string

c:\>test `string`
TCC: C:\test.bat [7]  No closing quote
TCC: C:\test.bat [7]  No closing quote
TCC: C:\test.bat [7]  No closing quote
C:\test.bat [7]  Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT]  condition ...] THEN & commands

c:\>test `"string"`
TCC: C:\test.bat [7]  No closing quote
TCC: C:\test.bat [7]  No closing quote
TCC: C:\test.bat [7]  No closing quote
C:\test.bat [7]  Usage : IFF [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] THEN & commands

For some reason @LEFT is getting confused with the backtick quoted strings. This is just a small piece of what I really want to do which is pass urls that have % signs, hence the back ticks. What I'm really doing is passing something like:
`"http://domain.com/file?param1=has%%20space&param2=has%%3dequal"`

I'm not really keen on SETDOS to disable variable expansion, but I'd like to hear of any potential work-arounds.

Thanks!
-gregg
 
May 20, 2008
3,515
4
Elkridge, MD, USA
|| This is just a small piece of what I really want to do
|| which is pass urls that have % signs, hence the back ticks. What I'm
|| really doing is passing something like:
|| `"http://domain.com/file?param1=has%%20space&param2=has%%3dequal"`
||
|| I'm not really keen on SETDOS to disable variable expansion, but I'd
|| like to hear of any potential work-arounds.

Investigate the plug-in SAFECHARS.DLL from Charles Dye. AFAIK it will do
exactly what you need. You can find it at
| http://www.unm.edu/~cdye/plugins/safechars.html


--
HTH, Steve
 
Similar threads
Thread starter Title Forum Replies Date
nickles Using backticks in a batch file Support 8
vefatica Literal double quotes in SHORTCUT's "args" parameter? Support 6
vefatica `Back quotes` - command line vs. batch file Support 5
R Inconsistency in @version's use of quotes Support 2
vefatica TPIPE: unbalanced escaped quotes in a regex? Support 5
A How to safely print variable's value without quotes? Support 9
Charles Dye TCC smashing Unicode quotes Support 9
vefatica Remove double-quotes with TPIPE Support 4
T TPipe: Replacing String with Double Quotes Support 3
greyfairer TCC Quotes needed for Arguments containing '='? Support 11
noahcoad Fixed Can't @iniread a section w quotes in the name Support 6
T KEYSTACK and double-double quotes dropping spaces Support 2
Steve Pitts How to? FFIND, regular expressions and double quotes Support 4
noahcoad Fixed tcc /k not emulating cmd.exe w double quotes Support 1
M How to? Parsing lines containing double quotes... Support 3
J Nested for loops and quotes Support 12
D How to? Windows Key-Left and Windows Key-Right Support 9
vefatica Ctrl-Alt-L (R, Left, Right). Support 8
C Erase all characters left or right from cursor location Support 2
D WAD Alt-Left doesn't work, but Alt-Shift-Left does Support 1
vefatica Updater left a mess Support 1
vefatica DO variable left with empty value Support 0
L left Behind Support 5

Similar threads