How do I call or run a separate executable on a QB program?

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
PunkMaister
Newbie
Posts: 2
Joined: Sun Feb 05, 2012 4:47 pm

How do I call or run a separate executable on a QB program?

Post by PunkMaister »

It's been a long while and I can't remember how.

It's to call or run a separate non QB based executable as an alternative in a small menu program I'm writing to complement a batch file used to run the gamw Redneck Rampage under DOSBox I want that when one exits the game for the user to have the option to either exit DOSBox entirely or to run the game's setup program if modifying the sounds/controls etc. is needed. Any help would be greatly appreciated thanks!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

You can use SHELL "program.exe" to run another program or batch file.

If the program has command line options you can include them too!

SHELL "cmd /c start min Notepad /p textfile.txt" 'would print a text file

MIN minimizes and MAX maximizes the Notepad window.


If your program uses graphic SCREEN modes you will have to change screen modes with SCREEN 0 and back to the graphic mode or Qbasic may freeze.

SCREEN 0
SHELL
SCREEN 12


It would not be advisable to exit DosBox from a Qbasic program as it is using it to run in the first place.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
PunkMaister
Newbie
Posts: 2
Joined: Sun Feb 05, 2012 4:47 pm

Post by PunkMaister »

Shell! I knew there was a command as I said I could not remember which Thanks a bunch! :D
Post Reply