Miscellaneous Operating Systems/Hardware

DOS environment variable expansion defective?

Maybe I'm defective myself, but the following strange thing happens
(tried with OpenDOS 7.01, DR-DOS 7.03 and MSDOS 6.22 command.com)

Code: Select all

C:\>set foo=bar
C:\>set
[...]
FOO=bar
C:\>echo %foo%
%foo%
C:\>


What the :evil:

Shouldn't I get "bar" on echo %foo% ?
Tried that on two different machines, even with plain DOS boot disk.

[edit: corrected typo]
:A3502L: :O2000: :O200: = :O200: - :O200: :O200: :Octane: :Octane: :320: :O2: :Indigo2IMP: :Indy:
+ | d | i | g | i | t | a | l | +apple +[...] ;)
Voralyan wrote:

Code: Select all

C:\>set foo=bar
C:\>set
[...]
FOO=bar
C:\>echo %foo%
%foo%
C:\>




um. what is the question here? that access to environment variables in DOS is case sensitive? I don't understand the problem.
:OnyxR: :IRIS3130: :IRIS2400: :Onyx: :ChallengeL: :4D220VGX: :Indigo: :Octane: :Cube: :Indigo2IMP: :Indigo2: :Indy:
On "echo %foo%" the value should be printed in the
next line and not the variable designator...

I tried the aforementioned example on WinNT's cmd.exe
and I get correctly "bar" as the output on "echo %foo%"...
But not on any DOS system running on two absolutely
different machines!

Maybe I'm overlooking something astonishing simple or
it's just the wrong pressure in the water pipes today... who knows?!

[edit: DOS is not case sensitive]
:A3502L: :O2000: :O200: = :O200: - :O200: :O200: :Octane: :Octane: :320: :O2: :Indigo2IMP: :Indy:
+ | d | i | g | i | t | a | l | +apple +[...] ;)
I have a vague recollection that the %foo% dereferencing only worked inside BAT files or in the environment passed to applications. I don't think it worked directly on the command line. I don't have a DOS system to try it out on nearby, though.
:Onyx2: 4x400MHz R12K Onyx2 IR2, 5GB RAM
:1600SW: :Indigo2IMP: R10K Indigo2 MaxIMPACT, 4 TRAMS, 768MB RAM, 2x9GB HD, CD-ROM, Phobos G160
Black Cardinal
Try

Code: Select all

echo %%foo%%

Exercise for the reader: why is this required?
Torfinn
tingo wrote: Try

Code: Select all

echo %%foo%%

Exercise for the reader: why is this required?


Escapes me.
Land of the Long White Cloud and no Software Patents.
porter wrote: Escapes me.

Shouldn't that be "Escapes me." ?
two girls for every boy ...
hamei wrote:
porter wrote: Escapes me.

Shouldn't that be "Escapes me." ?


Are you quoting me out of context?
Land of the Long White Cloud and no Software Patents.
It's right, works only in batch files.
Have been working with WinNT's too long I think...
:A3502L: :O2000: :O200: = :O200: - :O200: :O200: :Octane: :Octane: :320: :O2: :Indigo2IMP: :Indy:
+ | d | i | g | i | t | a | l | +apple +[...] ;)