DOS Prompt 1/

 BBS: Inland Empire Archive
Date: 03-24-92 (03:24)             Number: 197
From: DARYL POSNETT                Refer#: NONE
  To: DUANE BURRIS                  Recvd: NO  
Subj: DOS Prompt            1/       Conf: (2) Quik_Bas
KB>In a message on <Mar 16 19:22>, Duane Burris (1:321/214) writes:
KB>->  DB> Does anyone have a short solution to reading then
KB>->  DB> changing theDOS
KB>->  DB> Prompt preferably without shelling to dos.(but if thats
KB>->  DB> theeasiest..)
KB>-> Is this to operate as a child process?  I would use the
KB>-> ENVIRON statechange the prompt string in the enviroment.
KB> DB>  No its not. I would like to get the dos prompt, run my compiled
KB> DB> prog.
KB> DB> and change the prompt before returning to DOS. I could probably
KB> DB> do this
KB> DB> in a batch file but then the batch file could just be deleted. So
KB> DB> i need
KB> DB> to do this through quickbasic. Any other suggestions??

The following routines allow you to get information from and modify the
master enviroment.  They won't win any awards for efficiency or elegance
but they get the job done.

GetMasterEnvSeg% is the routine responsible for getting the location of
the master enviroment.  This uses the simplest method of locating the
master enviroment.  This should work most of the time, if you are
writing production code you may want to look at some of the other
methods.  Chapter 6 in "Undocument DOS" by schullman,michels et al shows
four different methods.  They claim that no one method is foolproof and
it may be necessary to use several methods and then assuming the address
that comes up the most often is the true master enviroment.

At any rate, If you need that kind of reliability the only function you
will need to change is GetMasterEnvSeg%, everything else will still

First the include file:

============================ Cut Here ==================================

' Master enviroment routines include file
' March 24, 1992
' Daryl Posnett
DECLARE FUNCTION GetMasterEnvVar$ (EnvVar$)
DECLARE FUNCTION SetMasterEnvVar% (EnvVar$, EnvVal$)
DECLARE FUNCTION GetMasterEnvVarInfo% (EnvVar$, EnvDef$, EnvLoc%)

============================ Cut Here ==================================

Now the main file:

============================ Cut Here ==================================

' Master enviroment routines
' March 24, 1992
' Daryl Posnett


'Get the master enviroment , return a string, each variable is
'                            seperated by a CR
FUNCTION GetMasterEnv$

  DEF SEG = GetMasterEnvSeg%
  EnvAdr% = 0

  temp$ = ""
    IF PEEK(EnvAdr%) = 0 THEN
      temp$ = temp$ + CHR$(13)
      temp$ = temp$ + CHR$(PEEK(EnvAdr%))
    END IF
    EnvAdr% = EnvAdr% + 1
  LOOP UNTIL PEEK(EnvAdr%) = 0 AND PEEK(EnvAdr% + 1) = 0
  temp$ = temp$ + CHR$(13)
  GetMasterEnv$ = temp$
>>> Continued to next message
 X SLMR 2.0 X Have you tried an Applied Design Group product today ?

--- Maximus 2.00
 * Origin: Inland Empire Archive (1:346/10)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET