Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!src.honeywell.com!msi.umn.edu!cs.umn.edu!cybrspc!roy From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail) Newsgroups: comp.os.msdos.programmer Subject: Re: Command.com and a message Message-ID: <6Z0RT1w163w@cybrspc> Date: 7 Dec 90 00:32:04 GMT References: <67560@unix.cis.pitt.edu> Organization: Villa CyberSpace, Minneapolis, MN Lines: 29 kwgst@unix.cis.pitt.edu (Karol W Gieszczykiewicz) writes: > Greetings. I am a C programmer with a bit of 8088 assembly > "fooling around". I am writing a program that has to load > command.com (shell). It works, but I want it to display > a little message that reminds the user of what they did. > (just so they don't run my program again, instead of "exit"- > ing back to it). Should be very easy... The spawned command.com will inherit a copy of the parent's environment, so you can grab the current prompt and modify it, then spawn the new shell. Something like this (untested, but simple) char s[80]; sprintf(s,"Type EXIT to return\n%s",getenv("PROMPT")); putenv(s); This does not modify the master environment, so the prompt will revert to normal when your program exits. You'll want to take care to only make this call once, though, or else you'll end up with strange results on the second and later shells you spawn. -- Roy M. Silvernail |+| roy%cybrspc@cs.umn.edu |+| #define opinions ALL_MINE; main(){float x=1;x=x/50;printf("It's only $%.2f, but it's my $%.2f!\n",x,x);} "This is cyberspace." -- Peter da Silva :--: "...and I like it here!" -- me