4
votes

I have a problem with my virtual PC running on MS-DOS 6.22. I need to use the variable Date, but I can't get it since whenever I try to echo a variable it shows %variable% instead.

I tried this on Windows console:

Set name=test
echo %name%
the result was "test"

When I tried it in the virtual machine i got %name% as a result.

Does anyone know how to resolve this please?

1
Try echo %%name%% or start your test in .bat file, not directly in console.i486
Hi, thanks for replying. I tried %%name%% and it didn't work, same for the .bat file. I came here in the last resort.Hicham Benhima
In DOS I believe that %var% expansion only works in batch files, not at the command line directly.Ian Roberts

1 Answers

3
votes

%Date% isn't part of MSDos 6.22. It only has the date command.

command /c echo. |date

Echos the date command