1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Support' started by gregg, Feb 18, 2010.

  1. gregg

    Joined:
    Feb 17, 2010
    Messages:
    3
    Likes Received:
    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
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    || 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
     

Share This Page