Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rpics!chassin From: chassin@rpics.RPI.EDU (Dave Chassin) Newsgroups: comp.sys.ibm.pc Subject: Re: DOS command in batch file does not work when "echo off" Message-ID: <1004@rpics.RPI.EDU> Date: Tue, 17-Mar-87 17:57:51 EST Article-I.D.: rpics.1004 Posted: Tue Mar 17 17:57:51 1987 Date-Received: Thu, 19-Mar-87 04:41:22 EST References: <5792@mimsy.UUCP> <3350@iuvax.UUCP> Lines: 48 Summary: details In article <3350@iuvax.UUCP>, bobmon@iuvax.UUCP (RAMontante) writes: > deba@mimsy.UUCP (Deba Patnaik) writes: > >PROMPT command does not work when "ECHO OFF'" but works when > >"ECHO ON". These are the lines in the batch file. > > > >ECHO OFF > >IF %1 == RED PROMPT $e[41m > >IF %1 == GREEN PROMPT $e[42m > > [...] > > I'm using (Zenith's release of) MSDOS v3.1, with (Zenith's version of) a CGA > card. I do just this in my AUTOEXEC.BAT file; the very first line is "echo > off" and a subsequent line defines a fairly long and involved prompt (33 char's > that set up four different colors...). It works fine for me. The differences > that I can see between my .BAT file and the example are that my "prompt..." > command is on a line by itself rather than being the end of an "if" statement, > and I have some other "echo..." commands between the initial "echo off" and > the "prompt..." (intermediate colors, etc.). > The important thing to understand is that the PROMPT command does not affect the screen until the prompt is printed out. This is happens after any one of the following events (more usual ones, that are others): 1. ECHO ON is executed AND a command is entered (which will happen) 2. another batch file is called (either using COMMAND or not) (note that echo will be ON for the new batch file either way, but that if you use COMMAND you can return to you old batch file and echo will still be off, and if you don't use COMMAND you can't returned to the old batch file anyway) 3. or the batch file ends. The reason is that the prompt command only sets what the prompt will be when it is displayed, which doesn't happen then. If I looked at the commands in your AUTOEXEC file I'm certain that I could show you that the presence of the IF statement makes no difference, and that it's something else. Dave _____________________ David P. Chassin Rensselaer Polytechnic Institute | School of Architecture __+__ Troy, NY 12181 / _ \ USA | | | | /=======/ = \=======\ (518) 266-6461 | _ | _ | _ | | | | | | | | | | | chassin@csv.rpi.edu | = | | | | = | =======================================================================