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

SET=

Discussion in 'Support' started by Roedy, Mar 4, 2013.

  1. Roedy

    Joined:
    Jun 8, 2008
    Messages:
    120
    Likes Received:
    2
    I have always though that SET x=y should be inherited by any *.BTM file I call, however, it should not affect my caller's value. My current TCC does not appear to be behaving that way. The docs do not specify the expected behaviour.

    1. How it is supposed to behave?
    2. Please document that in Help Set.
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,934
    Likes Received:
    30
    A BTM sees the same environment as the TCC which started it. If a BTM changes the value of an environment variable without SETLOCAL having been issued then that change will be evident in TCC after the BTM exits. Can you be more specific about the problem ... with an example, perhaps.
     
  3. Stein Oiestad

    Joined:
    Sep 11, 2012
    Messages:
    55
    Likes Received:
    1
    I guess TCC is designed to behave like CMD.EXE.
    As written above, you could easily get what you want by using SETLOCAL/ENDLOCAL.
    http://jpsoft.com/help/index.htm?setlocal.htm
    Example:
    1.btm
    -------------
    @echo off
    set x=1
    call 2.btm
    echo 1.btm - after return: %x%
    2.btm
    -------------
    @echo off
    setlocal
    echo 2.btm - before change %x%
    set x=2
    echo 2.btm - after change %x%
    endlocal
    Output
    ----------------
    2.btm - before change 1
    2.btm - after change 2
    1.btm - after return: 1
     

Share This Page