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

Parsing problem? (IFF, "", &)

Discussion in 'Support' started by nikbackm, Jun 22, 2009.

  1. nikbackm

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    1
    TCC 10,00,67 Windows XP [Version 5,1,2600]

    I encountered a strange phenomenon when debugging a batchfile using IFF.

    Here's a simplified illustration.

    PHP:
    @echo off

    alias mystart
    =`iff "%@unquote[%1]" == "." .AND. %# == 1 then & echo start dot & else & (echo start %$) & endiff`

    echo.
    echo 
    Test 1 direct arg
    echo.

    mystart .
    mystart "."
    mystart "q&a.txt"

    echo.
    echo 
    Test 2 arg via variable
    echo.

    mystart .
    mystart "."
    set arg="q&a.txt"
    mystart %arg%
    The output should be the same in both cases, but that is not the case.

    PHP:
    14:39 (2009-06-22C:\User\fl>test

    Test 1 
    direct arg

    start dot
    start dot
    C
    :\User\fl\test.btm [11]  Usage IFF [NOTcondition [.AND. | .OR. | .XOR. [NOTcondition ...] THEN commands
    TCC
    C:\User\fl\test.btm [11]  Unknown command "a.txt]"
    start dot
    TCC
    C:\User\fl\test.btm [11]  Unknown command "else"
    start "q&a.txt"
    TCCC:\User\fl\test.btm [11]  Unknown command "endiff"

    Test 2 arg via variable

    start dot
    start dot
    start 
    "q&a.txt"
    The problem seems to be using IFF to compare strings with embedded '&' characters. But only when giving the problem string directly to the alias using IFF, if the argument is provided via an environmen variable it works as expected.
     

Share This Page