volatile variable

Oct 18, 2008
339
2
Hello - I am not sure if this is an error -- if not I would apprecaite some
advice on how to get it to work


I start tcmd, which in turn start tcc. I have a tcstart.cmd file, and one of
the items in the file is to set a volatile variable, ie


set /e /v foo=1


I then have code in the tcstart.cmd file to check to see if "foo" variable
exists and has been set. What I am seeing is that when I create a new tcc tab,
it does not see to be picking up that foo has been set -- is this the way this
is supposed to work? Thanks for any help
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
I start tcmd, which in turn start tcc. I have a tcstart.cmd file, and one of
the items in the file is to set a volatile variable, ie

set /e /v foo=1

I then have code in the tcstart.cmd file to check to see if "foo" variable
exists and has been set. What I am seeing is that when I create a new tcc tab, it does not see to be picking up that foo has been sethelp

Not reproducible here. I'd have to see your TCSTART.CMD file to debug it any further. (Are you sure the new TCC is executing your TCSTART?)

You can check the volatile registry entries by starting regedit and looking at HKCU\Volatile Environment.
 
May 31, 2008
382
2
set /e /v foo=1
I don't know what it could be. I use volatile variables in my boot scripts and they work just fine. However, YMMV depending on the version of Windows you're using - especially old versions.
Are you setting foo from a regular Windows GUI session or from a remote CLI session? I found that SET /V foo=1 doesn't work in the latter case. My (quite old) notes say:
:: This script uses SET /V (volatile environment) which returns an error
:: when the user isn't logged into a Windows GUI session.
:: If the user is logging in from a remote CLI session, and the same login
:: is already activated in a Windows GUI, SET /V works; it returns errors
:: if the user is connecting exclusively from a remote CLI session.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I see something peculiar:

Code:
v:\> set /v foo
TCC: Not in environment "foo"

v:\> set /v foo=1

v:\> set /v foo
1

v:\> unset /v foo
TCC: Not in environment "foo"

It's the same with /u

Code:
v:\> set /u foo
TCC: Not in environment "foo"

v:\> set /u foo=1

v:\> set /u foo
1

v:\> unset /u foo
TCC: Not in environment "foo"

The registry variables **do** exist.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
That was Win7. The same thing happens in XP. And

Code:
v:\> which set
set is an internal command

On Thu, 15 Sep 2011 11:16:15 -0400, vefatica <> wrote:

|I see something peculiar:
|
|
|Code:
|---------
|v:\> set /v foo
|TCC: Not in environment "foo"
|
|v:\> set /v foo=1
|
|v:\> set /v foo
|1
|
|v:\> unset /v foo
|TCC: Not in environment "foo"
|---------
|It's the same with /u
|
|
|Code:
|---------
|v:\> set /u foo
|TCC: Not in environment "foo"
|
|v:\> set /u foo=1
|
|v:\> set /u foo
|1
|
|v:\> unset /u foo
|TCC: Not in environment "foo"
|---------
|The registry variables **do** exist.
 
Oct 18, 2008
339
2
Not reproducible here. I'd have to see your TCSTART.CMD file to debug it any further. (Are you sure the new TCC is executing your TCSTART?)

You can check the volatile registry entries by starting regedit and looking at HKCU\Volatile Environment.

Hello --

Thanks for the reply -- I don't know if it matters, but the OS is xp (with all fixes and sp's) 32 bit -- Since I could not get it to work, I deleted the code and used a file in the %temp dir as an alternative -- What I do remember about the exact code is that the "set" command was not in the tcstart (the tcstart file is tcstart.cmd) file, but a file called profile.btm that it called
 
Similar threads
Thread starter Title Forum Replies Date
fpefpe How to? Volatile Registry Support 6
M Verification re volatile variables... Support 41
fpefpe volatile environment Support 5
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
fpefpe How to? Global variable set /v Support 4
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
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1
B WAD environment variable in TCC.exe Support 2
Frank watch an array variable in ide/bdebugger Support 2
vefatica Conditional expressions in a variable? Support 2
CWBillow UNSET a Variable Support 7
M Updating environment variable from C++ fails erratically in version 14... Support 57
Frank problem with environment variable x86 vs. x64 Support 2
Charles Dye Unbalanced parentheses in variable expansion Support 12
D WAD Multiple TEE causese weird variable scoping? Support 7
H Variable not expanding with detach Support 3
T Bug in variable expansion Support 4

Similar threads