VOGONS

Common searches


[SOLVED] Environment Variables not working

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by danielc

User metadata
Rank Member
Rank
Member

Very strange error. I searched everywhere, and I know my DOS stuff so I think it's a bug.

This is what i do to get the error...

SET VAR=HELLO
ECHO %VAR%

...and the resulting echo is simply %VAR% instead of HELLO.

I am making a little menu in my DOSBox to launch my games (a distro of freeware games for cross-platform DOSBox, thus a Windows frontend is not feasable) and I just can't do any conditional statements on variables.

Help please! Thanks so much in advance! 😀

Last edited by danielc on 2009-03-11, 00:14. Edited 1 time in total.

Regards,
CosmicDan

Reply 2 of 11, by danielc

User metadata
Rank Member
Rank
Member
ripsaw8080 wrote:

You "know your DOS stuff", yet you're expecting something intended for batch files to work directly from the command prompt?

I know more than most at least, I was just trying to state that I do have experience.

I tried it in a BAT file and had the same result. Still, SET and ECHO should work directly from the commandline - its the %%VAR%% that changes in some versions of DOS.

I just find it hard to believe that I am even encountering this, from my searches nobody else seems to have. FYI i'm running the Win32 build of DOSBox v0.72 (precompiled download) and I'm on XP Pro x86 aswell.

Thanks for your valuable commitment there, I was hoping I was just making a stupid mistake... sorry for asking such a stupid question but i've tried every syntax and fully read all the DOSBox documentation and am 100% stumped.

Also tested on 0.63, same result. Is there anything in my .conf that could be screwing this up? 🙁

EDIT: Oh my gosh.... i'm such an idiot.... thanks for making me triple check my scripts... thanks a lot you have my apologies. SOLVED.

That's so wierd that echo from commandline can't enumerate variables in DOSBox... is this by design or just not implemented?

P.S. (Off-topic) Pon pon pata pon-pon!

Regards,
CosmicDan

Reply 4 of 11, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

I haven't tested to verify your results but it's likely true that it doesn't work.

DOSBox development is mainly focused on getting games to work so if a game or a game installer doesn't use this functionality then it won't be implemented.

This is a pretty simple thing so I'm sure it will be added if found that it's needed.

Last edited by DosFreak on 2009-03-11, 02:20. Edited 1 time in total.

DOSBox Compilation Guides
DosBox Feature Request Thread
PC Game Compatibility List
How To Ask Questions The Smart Way
Running DRM games offline

Reply 5 of 11, by danielc

User metadata
Rank Member
Rank
Member

Ah yeah, that's fair enough. I know fully that DOSBox is for DOS gaming and agree with it entirely, if you havn't noticed this is my first post I am new - but I want you guys to know that im not going to be pestering about running Windows 98 or some other rediculous thing 😜

Based on MS-DOS... well I use MS-DOS 7 (the one from Windows 95 I think?) for my own recovery enviornment and (correct me if i'm wrong) there must have been changes between 6 and 7; e.g., just now I found that IF ERRORLEVEL=0 must be done, whereas I always used to use IF ERRORLEVEL 0 to get it to work. Having the = is more logical in essence, but I can't remember if the = or not is required in MS-DOS 5/6 or 7?

Well my syntax is a little rusty, but I think i'm getting back in the mode now 😀 Eh my point was, is DOSBox based specifically on any version of DOS? MS-DOS 6.11 or PC-DOS for example, or is it not really made to be entirely syntax-compatible with any traditional distro of DOS and has it's own plans (I assume its that, as the DOS functions are built around the game support - as you said).

P.S. I am currently learning at a next level the language of C/C++ and might be inclined soon about implementing some expansions to the inbuilt commands.. for example, nested FOR and IF statements with the parenthesis () like what the NTVDM can do. Who would I talk to about that if I ended up making it? Or would it be best to just post it in the Patches section?

ripsaw8080: I think you're right, the echo %var% is part of NTVDM and not true DOS... can't believe I didn't find that out over the years (maybe I did and just adapted to Windows forgetting the history - shame on me!)

EDIT: I have no idea where I got the ERRORLEVEL 0 (without equals sign) from, because it's still exactly the same in XP and Vista.... with an = or < or > so it musta been some obscure DOS. Then again, I hardly used ERRORLEVEL when making commandline tools I made them always pipe output for error checking (something not well optimized for batch files in DOSBox due to the need for retarded 3rd-party commandline tools).

Well this thread as just turned into a rant now haha. Thanks to both you guys for your replies 😀

Regards,
CosmicDan

Reply 8 of 11, by IIGS_User

User metadata
Rank Oldbie
Rank
Oldbie
danielc wrote:

Also tested on 0.63, same result. Is there anything in my .conf that could be screwing this up?

Why do they dig out ancient DOSBox versions that has been created before the earth was born? 😵

Klimawandel.

Reply 9 of 11, by danielc

User metadata
Rank Member
Rank
Member
IIGS_User wrote:
danielc wrote:

Also tested on 0.63, same result. Is there anything in my .conf that could be screwing this up?

Why do they dig out ancient DOSBox versions that has been created before the earth was born? 😵

Because "they" might have downloaded DOSBox once upon a time when they only had the internet at work, and used it for about 2 years and never had a major problem with it... haha!

I thought 0.63 was a bit of a milestone release from memory? Probably not, i'm talking crap most likely. Heh.

Well I got it solved, so admins/mods feel free to lock the thread. Thanks again!

Regards,
CosmicDan

Reply 10 of 11, by inukaze

User metadata
Rank Newbie
Rank
Newbie
danielc wrote:
I know more than most at least, I was just trying to state that I do have experience. […]
Show full quote
ripsaw8080 wrote:

You "know your DOS stuff", yet you're expecting something intended for batch files to work directly from the command prompt?

I know more than most at least, I was just trying to state that I do have experience.

I tried it in a BAT file and had the same result. Still, SET and ECHO should work directly from the commandline - its the %%VAR%% that changes in some versions of DOS.

I just find it hard to believe that I am even encountering this, from my searches nobody else seems to have. FYI i'm running the Win32 build of DOSBox v0.72 (precompiled download) and I'm on XP Pro x86 aswell.

Thanks for your valuable commitment there, I was hoping I was just making a stupid mistake... sorry for asking such a stupid question but i've tried every syntax and fully read all the DOSBox documentation and am 100% stumped.

Also tested on 0.63, same result. Is there anything in my .conf that could be screwing this up? 🙁

EDIT: Oh my gosh.... i'm such an idiot.... thanks for making me triple check my scripts... thanks a lot you have my apologies. SOLVED.

That's so wierd that echo from commandline can't enumerate variables in DOSBox... is this by design or just not implemented?

P.S. (Off-topic) Pon pon pata pon-pon!

Man how you solve it ? you say you solve but you don't say how :'( i had a month trying with simple things like
set msg="Hello World"
echo %%msg%%

i just get
%%msg%%

Reply 11 of 11, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

You are kidding right? A month?
You have one set of % too many... (and add @ to hide the commands from the prompt

@set msg="Hello World"
@echo %msg%

I'm also closing this thread for necroposting. If you have further problems, please post in a new thread

Attachments

  • testbat.png
    Filename
    testbat.png
    File size
    73.73 KiB
    Views
    651 views
    File license
    Fair use/fair dealing exception

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox