How to? Global variable set /v

Oct 18, 2008
339
2
Hello -- Is this by design .... I issued the the command

set /v foo=%_date %_time

it a tabbed tcc window running under tcmd

I then created a 2nd window and the variable "foo" is not defined -- is this by defined ?

create "foo" outside of tcmd, each created tab'ed window had "foo" defined

thanks

fpe
 
May 20, 2008
11,415
99
Syracuse, NY, USA
I think it is by design. Your second tab got its environment from its parent, TCMD, and TCMD got its environment before you "set /v foo ...".
 
May 20, 2008
11,415
99
Syracuse, NY, USA
I think it is by design. Your second tab got its environment from its parent, TCMD, and TCMD got its environment before you "set /v foo ...".
Maybe I was wrong about that. Your experiment works here. Start TCMD ... in the one (default) tab, "SET /V zzz=xxx" ... start a new tab ... and I find that zzz=xxx. I think you need to ...

Options ... TCMD ... Advanced ... check "Update Environment on System Change"
 

rconn

Administrator
Staff member
May 14, 2008
12,364
150
TCC sessions get their environment from their parent. If TCC is in a tab window, the parent is TCMD, not the Windows shell, so updating variables in the shell won't have any effect until TCMD is restarted.

If you go to the Options menu in TCMD and select "Configure Take Command / Advanced", you can select the "Update Environment on System Change" option to have TCMD's environment automatically updated.
 
Similar threads
Thread starter Title Forum Replies Date
D Documentation Help "Startup" page does not describe global lists Support 0
WadeHatler Any way to disable ALL the global hotkeys? Support 8
vefatica GLOBAL /Q? Support 2
Patulus GLOBAL command is very slow Support 28
vefatica @SMOPEN and "Global\" Support 3
C How to? GLOBAL question Support 5
P Disable global hotkey Ctrl+Shift+T Support 19
vefatica Dumping global lists to the *sav files Support 17
vefatica GLOBAL Support 4
Stefano Piccardi parsing issue in command GLOBAL Support 3
vefatica Aliases global vs. local Support 12
D Directory history file and global directory history Support 23
mdwyer @replace - global use in a text file Support 3
C sharing global histories between different TCMD versions? Support 5
vefatica Sorting the global dir history Support 13
D Parsing an array variable to an array does not work Support 5
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
P Inserting string into a variable. Support 3
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R Difference between TCC and CMD: variable names with hyphens Support 4
Joe Caverly Get a variable type Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
rps For loop internal %_for_files variable? Support 2
A How to safely print variable's value without quotes? Support 9
vefatica Array name in a variable? Support 3
nikbackm TCC 20 variable expansion bug Support 6
X How to set %_INIREAD result to variable Support 5
Charles Dye _USBS variable Support 2
BeechComer Debugger: how to set %1 variable? Support 3
Mordachai Variable followed by function constantly failing... Support 5
T Variable indirection for arrays Support 1
Mike Hall Unexpected "Variable loop" in IF condition Support 10
vefatica If there's no PATH variable ... Support 5
C Maximum length for a variable Support 8
D WAD Internal variable _cpu is undefined Support 2
I Change value of a variable while debugging Support 3
I "IF" command in a variable does not expand redirection variable name Support 0
J Variable setting regression in tcc17 ? Support 5
Jay Sage WAD Variable _LOGFILE Not Working Support 2
D Fixed Change in behavior of variable expansion between 16 and 17 Support 3
rps Fixed Using last argument variable ! Support 5
Jay Sage Brackets Around Variable Names Support 11
D Internal variable _tctabs within TCExit Support 9
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
J Set environment variable from stdout of command Support 3
nickles Passing a variable to a command w/o adding it to the local environment Support 7
nickles WAD Variable name gets changed within FOR loop Support 2
nikbackm FUNCTION with variable number of arguments Support 17
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2

Similar threads