Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcuhc!hpcupt3!defaria From: defaria@hpcupt3.cup.hp.com (Andy DeFaria) Newsgroups: comp.lang.c Subject: Re: DOS Environment Variables Message-ID: <45690006@hpcupt3.cup.hp.com> Date: 10 May 91 03:51:23 GMT References: <91125.051531AURPS@ASUACAD.BITNET> Organization: Hewlett Packard, Cupertino Lines: 17 >/ hpcupt3:comp.lang.c / AURPS@ASUACAD.BITNET / 5:15 am May 5, 1991 / >Does anyone know how to permanently change a DOS environment variable from >within an executing program? PUTENV() changes/creates a variable but it >is only in effect while the program is running. As soon as I go back to >DOS, the environment is restored to its original variables. I'm using >Turbo C. My understanding is that you have to change the "master environment" by walking back the PSP (or something like that). I had gotten some Turbo Pascal code to do this but I recall some big problems with this whole approach and I abandoned it. It had something to do with the face that if you try to change an existing environment variables value then the new value can't be larger that the old value and if it is a new environment variable then you have to be careful about running out of environment space (and there is only a couple of bytes of extra environment space). Like I said I could dig up the information if you like.