getting a qbasic program to run the command to start another non qbasic 
Author Message
 getting a qbasic program to run the command to start another non qbasic

I have just started to learn how to program in Qbasic that came with my computer
and my problem is finding a statement that will call a program from DOS, like
going to windows or the command that starts doomII(doom.exe), to put in my
program's code.  I would appreciate any help given.  My e-mail address is

                                    Thanks in advance,

                                               Corey



Mon, 15 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic

Quote:
> I have just started to learn how to program in Qbasic that came with my computer
> and my problem is finding a statement that will call a program from DOS, like
> going to windows or the command that starts doomII(doom.exe), to put in my
> program's code.

This is done by means of the SHELL statement, which starts up another
command interpreter. Usage:

SHELL "\GAMES\DOOMII\DOOM.EXE"

but I don't think this will work in this case. I don't know how much
conventional memory doomII needs, but I do know that you won't have much
left with QBASIC.EXE and your BASIC program already there. The same goes
for windows [yuck!].
I assume what you are trying to do is to make some sort of menu system
for starting your programs. However, you can't start a program of a
reasonable size with QBASIC.EXE in memory. So you need to exit QBASIC
first, and then start up the desired program, by means of a batchfile
which uses another batchfile created by your menu program. [Setting
errorlevel doesn't work with the crippled version of QuickBasic you get
with DOS].
Use a batchfile like this:

:loop
QBASIC /RUN menu.bas
call option.bat
goto loop

So, you need to have your program create a batchfile called option.bat
which has in it the commands to start up the chosen program, something like

PRINT "1) Program one"
PRINT "2) Program two"
PRINT : PRINT "Type 1 or 2..."
DO
  number$=INPUT$(1)
LOOP WHILE NOT INSTR("12",number$)
OPEN "\option.bat" FOR OUTPUT AS #1
PRINT #1,"c:"
SELECT CASE number$
CASE "1"
  PRINT #1,"cd\progs\prog1"
  PRINT #1,"prog1.exe"
CASE "2"
  PRINT #1,"cd\progs\prog2"
  PRINT #1,"prog2.exe"
END SELECT
CLOSE #1
SYSTEM 'I forgot how to exit to DOS from a QBASIC program. This probably
       'isn't it. Perhaps somebody else knows...

Hope this helps. Good luck!

Wouter Bergmann Tiest


** Electronic mail? Is that some kind of futuristic science fiction armour? **



Tue, 16 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic
Use SHELL as in

SHELL "DOOM.EXE"

That can call any exe, com, or bat but beware:  Qbasic uses up mucho
memory so you might not have enough to run doom, maybe, maybe not...




Tue, 16 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic

: I have just started to learn how to program in Qbasic that came with my computer
: and my problem is finding a statement that will call a program from DOS, like
: going to windows or the command that starts doomII(doom.exe), to put in my
: program's code.  I would appreciate any help given.  My e-mail address is

:                                  

The obvious answer is the basic command CHAINfollowed by the program name
you wish to call...
N
(ex CHAIN "DOOM.EXE")



Fri, 19 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic

Quote:

> : I have just started to learn how to program in Qbasic that came with my computer
> : and my problem is finding a statement that will call a program from DOS, like
> : going to windows or the command that starts doomII(doom.exe), to put in my
> : program's code.  I would appreciate any help given.  My e-mail address is

> :                              

> The obvious answer is the basic command CHAINfollowed by the program name
> you wish to call...
> N
> (ex CHAIN "DOOM.EXE")

Or try "RUN".  
Ex:RUN "DOOM2.EXE"
Run, and I think chain, need to have a COM, EXE, or BAT file extension,
unfortunately, so you can't use any switches.
EX: RUN "DOOM2.EXE -FILE WAR.WAD"----INVALID
EX: RUN "DOOM2.EXE"----VALID


   **********    | and Online Media Advertising  | TELEPHONE: 503.222.9508
  ***      ***   | to the Portland Metropolitan  | FACSIMILE: 503.796.9134  
  *  EUROPA  *   | Area                          |      DATA: 503.222.4244



Thu, 25 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic


: > The obvious answer is the basic command CHAINfollowed by the program name
: > you wish to call...
: >
: Or try "RUN".  
: Ex:RUN "DOOM2.EXE"
: Run, and I think chain, need to have a COM, EXE, or BAT file extension,
: unfortunately, so you can't use any switches.
: EX: RUN "DOOM2.EXE -FILE WAR.WAD"----INVALID
: EX: RUN "DOOM2.EXE"----VALID

Are you sure you don't mean SHELL "DOOM.EXE" in which case I still must
give the warning that your program will not release the memory it uses
making it a near impossibilty to load large programs such as Windows/Doom,
ect.

I'm not sure what the original question was, but I believe RUN/CHAIN are
for other Basic programs tha will be compiled with your program.
--

    ** If only the good die young, then I'm gonna live forever >;-) **



Thu, 25 Sep 1997 03:00:00 GMT  
 getting a qbasic program to run the command to start another non qbasic

: Are you sure you don't mean SHELL "DOOM.EXE" in which case I still must
: give the warning that your program will not release the memory it uses
: making it a near impossibilty to load large programs such as Windows/Doom,
: ect.

: I'm not sure what the original question was, but I believe RUN/CHAIN are
: for other Basic programs tha will be compiled with your program.

Oops, QBasic doesn't compile, so RUN/CHAIN will simply change comtrol to the
BAS file specified and interpret it. RUN unloads the current BASIC SOurce
code and executes the NEW, while CHAIN continues with the First after
execution of the New code is done.

Under Compiled BASIC RUN can execute an EXE or COM file only after being
Compiled, and not within the IDE, CHAIN follows the same rules. However
you must use the RUN-TIME Module to do this and pass variables with CHAIN.

--

    ** If only the good die young, then I'm gonna live forever >;-) **



Thu, 25 Sep 1997 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Incorporating non-QBasic graphics into QB 4.5 programs

2. Getting the COMMAND line arguments in QBASIC

3. qbasic editor starts after program

4. 10-year-old starting to program with QBasic 1.1

5. Running DOS Commands from QBasic

6. Passing a command line parameter to a QBASIC 4.5 program

7. Making a Qbasic program execute a DOS command

8. DOS commands in a Qbasic program

9. Running Games And Other Programs From QBasic

10. Help running qbasic programs

11. Running QBasic program from Netscape

12. QBasic Homepage With All Cool QBasic Goodies

 

 
Powered by phpBB® Forum Software