Path: utzoo!utgpu!water!watmath!watdcsu!dmurdoch From: dmurdoch@watdcsu.waterloo.edu ( D. Murdoch - Statistics ) Newsgroups: comp.sys.ibm.pc Subject: Re: Interactive BAT files: here's how Message-ID: <5137@watdcsu.waterloo.edu> Date: 11 Oct 88 13:12:30 GMT References: <8810040015.AA21729@decwrl.dec.com> <1317@micomvax.UUCP> Reply-To: dmurdoch@watdcsu.waterloo.edu ( D. Murdoch - Statistics ) Organization: U. of Waterloo, Ontario Lines: 22 In article <1317@micomvax.UUCP> ray@micomvax.UUCP (Ray Dunn) writes: [ a lot of completely correct information, then...] >... it is easy >to write a general purpose C program which will return the user input >through standard environment variables (e.g. arg1, arg2, arg3....). This >can then be used in all .bat files that require the facility, and the tests >can be like: > >if %arg1%==reply goto label > >In MS C, setting environment variables is easy. You use the putenv library >call, putenv("arg1=fred");, sets arg1 to "fred", whether arg1 existed >before or not. Doesn't putenv only affect the environment of the C program (and its children)? The parent environment remains unchanged. To change it, you need one of those routines that uses undocumented (i.e. unreliable) methods to find the parent environment, and patches the changes in there. Duncan Murdoch