Message-ID: <19971027042922.11703.qmail@hotmail.com> From: "John Patton" To: djgpp AT delorie DOT com Cc: bporter AT rabble DOT uow DOT edu DOT au Subject: Re: DOS stuff Content-Type: text/plain Date: Sun, 26 Oct 1997 20:29:17 PST Precedence: bulk >> Hi guys, >> >> Here's my problem (it always starts with that...): >> >> I would like to be able to set an environment variable in DOS. I would >> like to be able to do this with DJGPP. I would also like to make the >> variable stick, i.e. command.com's environment. > >Although theoretically possible, doing this won't always work and it is >considered a very bad thing to mess with other programs space, especially >once in protected mode (it is hard enough to write a program that works >under set conditions, let alone when anybody can come along and mess with it >:) > >> How can I set a parent >> process's environment string to new values, specifically command.com, >> using DJGPP? I know this is a rather odd question, and I'll probably >> get flamed for asking something like this about DOS,... but I thought >> I'd give it a shot... Any suggestions would be greatly appreciated >> because I'll be forced to go back to a 16-bit Borland compiler to make >> this work . >> >No, don't do that! I've seen this done before, but it was very crude even in >16-bit real mode. I can't remember exactly how, though (but could look it >up)... my suggestion would be just to call another command.com (sure, it's >two more programs in memory, but if your's is small...) and it will get a >copy of yours. > >What is the use of the program doing this anyway? I guess another approach >could be to have your program called from a batch file, which calls another >batch file after your program exits, and your program could create this file >and put the appropriate SET instructions in that file... Actually, Brett, that's what I'm doing--I'm creating a batch file in my program... The program itself is called from an initial batch file that then calls the created batch file to set the environment var... The basic idea of the app is to detect what video card is installed on a machine and set an environment variable associated with a directory where the video card's files are located and copy the files to the Windows directory so Windows can run in 256 colors on a network. This is being run on a local college's network and I'd like to be able to set command.com's environment space instead... It would definitely run a _lot_ cleaner. I have a method, but I haven't checked it's stability on a network yet, _and_ it's in 16-bit Borland code with inline assembler. I'm not against learning a new form of assembler, I just would like to get this project finished, and finished the right way ;) Graphics programming is *_definitely_* more fun. Thanks for your help, -Johnny P. Sew Windows install. See Windows run. See Windows crash. See Windows install... ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com