Qbasic SHELL command and environment limit

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Posts: 41
Joined: Wed Oct 16, 2019 11:28 am

Qbasic SHELL command and environment limit

Post by mikefromca »

I'm programming my own web server in quickbasic. and the idea which sometimes does and sometimes does not work is invoking external commands through dos shell. The whole program simply crashes. I do all my testing in DOSBOX and the last program listed in the titlebar is COMMAND so somewhere in there a crash occurs.

What my web server does is creates a batch file, populates it with a bunch of SET commands to pass the names and values of HTTP headers and the same with the query string Some values are as long as 100 characters (especially the user agent string coming from a web browser).

Then after that it executes a simple program. Right now that simple program is a compiled standalone QuickBasic program which prints a standard message.

After that, the batch file is supposed to exit and return to QuickBasic.

I find things work if I don't set too many values in the DOS environment.

But is there a way to set more?

I mean I know of the FRE command to learn about free storage for things, but is there a way I can associate the results of that command with how much environment space I can use up in DOS?

I don't want to set variables via files and have the program open them because that causes the slowdown in user script processing.

So is there a way I can calculate the free environment space I have for storing values with the DOS set command? I don't want my batch file to cause QuickBasic to crash partway through.

For reference, this is the latest batch file that was generated from my webserver:

Code: Select all

@echo off
set Host=
set User-Agent= Mozilla/5.0 (X11; Linux i686; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40
set Accept= text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
set Accept-Language= en-US,en;q=0.5
set Accept-Encoding= gzip, deflate
set Referer=
set Connection= keep-alive=0
set Cache-Control= max-age=0
\HTDOCS\\MINI.EXE > serverpr.out
and serverpr.out is the file that contains the screen output after mini.exe was executed.
Posts: 69
Joined: Wed Jun 20, 2007 12:31 pm
Location: LI, NY

Re: Qbasic SHELL command and environment limit

Post by Erik »

Are you getting "Out of environment space" error messages with the set command in your batch file?

You can bump that size up in the config.sys at the expense of losing some conventional RAM by adding something like this:

Code: Select all

I haven't tried in DOSBox but it worked for me on my 486 with DOS 5.0 when I ran out of environment space for batch variables.
Post Reply