volatile environment

Oct 18, 2008
339
2
I'm not sure if this is a bug.

In my tcstart.btm file, I set a volatile environment variable like this:

set /e /v foo=bar

When my PC starts up, I have tcc in the startup folder. once the system starts
and is settled, I then start tcmd from the quick start menu. I can see while
(tab) tcc is starting it takes the path in tcstart where it finds the FOO
variable via

if defined foo .....

I was making some changes and remove tcc from the startup folder, and would then
just started tcmd from quick start. when the first tcc tab was created I notice
that tcstart took the path were FOO was NOT defined, defined it and set it in
volatile and environment.

I then noticed that the next tcc tab I created took the path in tcstart were FOO
did not exist. I thought I was missing something so, I modified tcstart and
added

set /v

Before testing if FOO was defined. I could see from the output of set /v that
FOO was in the list, but the next line in the bat file was

iff not defined FOO ...

The bat file followed the path as if FOO did not exist.

So, by the time tcstart is executing, has TCC loaded up all the defined
Environment variables from

HKLM\System\CurrentControlSet\Control\Session Manager\Environment,
HKCU\Environment, and HKCU\Volatile Environment
 
May 20, 2008
11,547
107
Syracuse, NY, USA
Like all programs, TCC gets it's environment from its parent (it doesn't "load" any variables).

If I understand you correctly ...

You started without the FOO variable and then started TCMD; TCMD had no FOO variable. Then, in TCC, you set (/v /e) FOO, so it went into the registry and into the current TCC's environment, but not into TCMD's environment. TCMD started the next TCC (tab) so that TCC got the same environment (from TCMD, without FOO) that the first TCC got.

I'm not sure if this is a bug.

In my tcstart.btm file, I set a volatile environment variable like this:

set /e /v foo=bar

When my PC starts up, I have tcc in the startup folder. once the system starts
and is settled, I then start tcmd from the quick start menu. I can see while
(tab) tcc is starting it takes the path in tcstart where it finds the FOO
variable via

if defined foo .....

I was making some changes and remove tcc from the startup folder, and would then
just started tcmd from quick start. when the first tcc tab was created I notice
that tcstart took the path were FOO was NOT defined, defined it and set it in
volatile and environment.

I then noticed that the next tcc tab I created took the path in tcstart were FOO
did not exist. I thought I was missing something so, I modified tcstart and
added

set /v

Before testing if FOO was defined. I could see from the output of set /v that
FOO was in the list, but the next line in the bat file was

iff not defined FOO ...

The bat file followed the path as if FOO did not exist.

So, by the time tcstart is executing, has TCC loaded up all the defined
Environment variables from

HKLM\System\CurrentControlSet\Control\Session Manager\Environment,
HKCU\Environment, and HKCU\Volatile Environment
 
May 20, 2008
11,547
107
Syracuse, NY, USA
Like all programs, TCC gets it's environment from its parent (it doesn't "load" any variables).

If I understand you correctly ...

You started without the FOO variable and then started TCMD; TCMD had no FOO variable. Then, in TCC, you set (/v /e) FOO, so it went into the registry and into the current TCC's environment, but not into TCMD's environment. TCMD started the next TCC (tab) so that TCC got the same environment (from TCMD, without FOO) that the first TCC got.

If that was the correct analysis, you can change that behavior by checking "Update environment on system change" on the Advanced tab of TCMD's configuration. Then TCMD will hear about the /v-change that TCC made (because TCC announces it to everyone) and add FOO to its own environment. Then new tabs will get it (from TCMD).
 
Oct 18, 2008
339
2
Like all programs, TCC gets it's environment from its parent (it doesn't "load" any variables).

If I understand you correctly ...

You started without the FOO variable and then started TCMD; TCMD had no FOO variable. Then, in TCC, you set (/v /e) FOO, so it went into the registry and into the current TCC's environment, but not into TCMD's environment. TCMD started the next TCC (tab) so that TCC got the same environment (from TCMD, without FOO) that the first TCC got.

Yes, that is the sequence -- the question is after the set /v foo why when I added a new tcc tab there was no
"foo", but the set /v shows foo in the list? In addition, I opened a cmd.exe outside of tcmd and foo was there?
 
Oct 18, 2008
339
2
If that was the correct analysis, you can change that behavior by checking "Update environment on system change" on the Advanced tab of TCMD's configuration. Then TCMD will hear about the /v-change that TCC made (because TCC announces it to everyone) and add FOO to its own environment. Then new tabs will get it (from TCMD).
OK -- I will give that a try
 
May 20, 2008
11,547
107
Syracuse, NY, USA
Yes, that is the sequence -- the question is after the set /v foo why when I added a new tcc tab there was no
"foo", but the set /v shows foo in the list? In addition, I opened a cmd.exe outside of tcmd and foo was there?

Because TCMD (which doesn't know about FOO) is starting TCC and giving that TCC its (TCMD's) environment.
 
Similar threads
Thread starter Title Forum Replies Date
fpefpe How to? Volatile Registry Support 6
M Verification re volatile variables... Support 41
fpefpe volatile variable Support 5
Peter Murschall v27.00.16/17: ENDLOCAL with exporting variables wipes out the complete Environment Support 2
T Is there a way to maintain the position in the environment list, while debugging? Support 10
D Unnecessary environment dependencies of TCC.EXE Support 3
T Portable Take Command installation for VDI environment Support 2
D v23 environment oddity Support 3
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
M Save the environment .. ;-) Support 2
Charles Dye Read-only environment variables wiped by SETLOCAL / ENDLOCAL Support 5
J Shell nesting level, and inherited environment variables Support 10
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
vefatica Environment refresh? Support 0
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
B WAD environment variable in TCC.exe Support 2
SeoulBigChris Save Environment (Tabs) on Exit? Support 3
fpefpe Documentation environment variables Support 3
fpefpe How to? Environment Variables changed Support 2
vefatica OT: Rex, how does CMD handle its environment? Support 0
M Updating environment variable from C++ fails erratically in version 14... Support 57
Frank problem with environment variable x86 vs. x64 Support 2
daniel347x How to get Take Command to read in all current system environment variables that CMD.EXE sees? Support 13
D Environment in elevated process Support 1
Peter Bratton IDE environment window display Support 0
D Environment variable oddity Support 12
vefatica Got IDE's environment tab back Support 0
S blanks in environment variable paths Support 4
vefatica What environment variables does IDE need? Support 3
tinjaw Looking for best practice for custom environment on tabs Support 0
E Environment variable in tcmd.ini Support 14
I Environment variable in OPTION screen? Support 2
E Environment variables, set and input Support 2
J trouble redirecting output to environment variable Support 7

Similar threads