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

Problem with %var:find=replace% syntax

Discussion in 'Support' started by Jim Cook, Feb 5, 2009.

  1. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    The syntax %var:find=replace% does not appear to work when the variable is
    an internal variable.

    TCC 10.00.48 Windows XP [Version 5.1.2600]
    TCC Build 48 Windows XP Build 2600 Service Pack 3


    D:\test>echo %_cwd
    D:\test

    D:\test>set zzz=%_cwd

    D:\test>echo %_cwd:test=qqqq% %zzz:test=qqqq%
    D:\test D:\qqqq

    --
    Jim Cook
    2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Sunday.
     
  2. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    On Thu, Feb 5, 2009 at 8:25 AM, JP Software Forums <neil@jpsoft.com> wrote:


    It appears _some_ internal variables are not affected, but some are.

    D:\test>set zzz=%CD%

    D:\test>echo %CD% .. %_CWD% .. %ZZZ%
    D:\test .. D:\test .. D:\test

    D:\test>echo %CD:test=qqqq% .. %_CWD:test=qqqq% .. %ZZZ:test=qqqq%
    D:\qqqq .. D:\test .. D:\qqqq


    --
    Jim Cook
    2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Sunday.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Thu, 05 Feb 2009 10:25:47 -0600, Jim Cook <> wrote:


    Did you expect it to work? I wouldn't.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    That makes sense to me. That nasty syntax is only there for compatibility with CMD.EXE, which does not support TC's internal variables -- but does have a few of its own, including CD.

    If you're writing for TC, you can and should use @REPLACE instead.

    </NEIL@JPSOFT.COM>
     
  5. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0

    Well, yes. That's why I reported it.

    Especially since %CD% does work but %_CWD% does not -- I find that very
    odd.

    --
    Jim Cook
    2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Sunday.
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    WAD; that ghastly syntax is strictly for CMD.EXE compatibility with environment variables. It will not work with internal vars.
     

Share This Page