Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

SET=

Jun
127
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.
 
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.
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.
 
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
 
Back
Top