Welcome!

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

SignUp Now!

how to work with env var with special characters in the name

Jun
137
3
I've got a strange program that creates some environment variables that have <> around the name, for example, one might be named <test>. How do I get the value of this environment variable? I couldn't seem to figure out anything, not even using the SETDOS /x-6. Note that the solution needs to be compatible with the current TCC v15, and also with 4nt v6.
 
I would try the form %[<test>] which was available in 4nt6 (IIRC); probably combined with SETDOS /X-6. That form may override the parser's rules for separating tokes, but no guarantees, not tested...
 
I would try the form %[<test>] which was available in 4nt6 (IIRC); probably combined with SETDOS /X-6. That form may override the parser's rules for separating tokes, but no guarantees, not tested...


I think, if you do it that way, you don't need the SETDOS -- TCC doesn't check for redirections inside the brackets. (But if the value of the variable contains weird values, then you'll still need SETDOS.)
 
I think, if you do it that way, you don't need the SETDOS -- TCC doesn't check for redirections inside the brackets. (But if the value of the variable contains weird values, then you'll still need SETDOS.)

That doesn't bear out in TCC 15.x. I didn't bother to check in 4nt 6.

->setdos
ANSI=0
COMPOUND=&
DESCRIPTIONS=1 (DESCRIPT.ION)
ESCAPE=^
EVAL=0.10
EXPANSION=0
MODE=1
NOCLOBBER=0
PARAMETERS=$
CURSOR OVERSTRIKE=10
CURSOR INSERT=100
VERBOSE=0

[Sun 7/21/13 @ 13:51:23]:
*** C:\ ***
->set [<x>]=test
TCC: (Sys) The system cannot find the file specified.
"C:\x"
 
I think Charles was referring to accessing the variable ... and that you'll have to use other means when setting it. For example,
Code:
v:\> set ^<x^>=foo
 
v:\> echo %[<x>]
foo
 
v:\> set
<x>=foo
*** SNIP ***
 
Oh, I see. Thanks for the clarification. Yes, this works properly in both old and current versions.
 
Back
Top
[FOX] Ultimate Translator
Translate