DOS bootdisk - qbasic menu

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
Anonymous

DOS bootdisk - qbasic menu

Post by Anonymous »

Im not sure if qbasic is what i should be using for this. I want to make a network bootdisk that will give you choice as to what NIC card you have. I just need the program to run my menu. Then it needs to run a few dos files. I just dont know how to make a qbasic program run a dos file. what would be the code to run dos files from a qbasic program?

example IF NIC% = 1 THEN (HERES WHERE I NEED IT TO RUN A .COM OR .EXE FILE)


thanks
User avatar
Travesty
Newbie
Posts: 7
Joined: Wed Oct 27, 2004 9:06 pm

Post by Travesty »

If all you're asking is how to run a DOS application from QBasic, then pretty much the only thing you need to know about is the SHELL command.

Syntax:

Code: Select all

SHELL [commandstring]
Example:

Code: Select all

SHELL "C:\MyApp.Exe"
Alternatively, you could consider creating a batch file (*.bat) instead... To do so, open up your favorite simple text editor (Notepad, preferably) and type in the following psuedo-code:

Code: Select all

@ECHO OFF
ECHO Running MyApp...
C:\MyApp.Exe
...And then save it with a .BAT extention. The file will execute the same way that an .EXE or .COM file would. However, if what you need is more than just executing a DOS application (or the other few things that a batch file can do), then I wouldn't recommend this method at all. Of course, you could always combine both methods, as well:
  • Create a batch file that displays some common text & runs a program
  • Open QBasic
  • Wherever within your program that you need to, type in the psuedo-code: SHELL "C:\MyApp.bat"
Your QBasic application will wait until all dos commands within your batch file are completed before execution returns to you, and then the execution will resume on the line following the SHELL command.
Hey... ever get that feeling of DejaVu?
Whenever I do, I stop and think,
"Hey... ever get that feeling of..." Hey...
Post Reply