Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!malgudi!caen!umich!vela!m.cs.uiuc.edu!wuarchive!decwrl!elroy.jpl.nasa.gov!jarthur!ucivax!milne From: milne@ics.uci.edu (Alastair Milne) Newsgroups: comp.lang.pascal Subject: Re: DOS Environment Variables Message-ID: <2813A6CD.20250@ics.uci.edu> Date: 23 Apr 91 03:15:24 GMT References: <4744@ash54.UUCP> <7333@vice.ICO.TEK.COM> Distribution: USA Organization: UC Irvine Department of ICS Lines: 37 In <7333@vice.ICO.TEK.COM> bobb@vice.ICO.TEK.COM (Bob Beauchaine) writes: >In article <4744@ash54.UUCP> hamilton@motcid.UUCP (Danial Hamilton) writes: >>My son programs using Turbo Pascal, and would like to pass >>a value from his Pascal program to another program via a >>DOS environment variable. Can he do this? Can someone >>tell him how? He knows how to set the errorlevel, and could >>accomplish his goal that way, but it is not as elegant of a >>solution as he would like. Any help out there? > The discussion on permanently changing an environment variable > was on this group some time ago; sorry, I can't refer you to > an article, but perhaps someone else can. Be warned; the topic > is probable more advanced than you think. Somebody posted a unit that was supposed to do this safely. Unfortunately I missed it :-( :-(. The trick is to add the variable to the environment of both your own program *and* the that of the shell that called it -- without at the same time corrupting DOS' memory list. As Bob says, rather an advanced topic. I must admit I find it ridiculous that proper facilities for passing data aren't provided. > Another scenario you might consider is using the Dos interprocess > communication area. Any good text on the inner workings of MS-DOS > will contain an explanation. The one I know of is Peter_Norton's_ > Guide_to_the_IBM_PC. This area is about 15 bytes long and, according to Norton, not documented for later DOS releases. I don't know how one is suppoed to use such a miniscule area. Clearly, it can mostly only be used to refer to where the actual data are kept -- but where is that? I suspect it goes almost totally unused. Alastair Milne