[alt.msdos.programmer] how to modify the parent DOS environment ??

laned@athena.ecs.csus.edu (Douglas A. Lane) (04/09/91)

All:

	I have seen a zillion environment editors, but I want to do something
	very simple.. that has "avoided" me..  to change or set a environment
	variable.  Unfortunately the change done in my program is not 
	permanent (see the example below).

	Another wrinkle: if there are 3 shelled programs (versions of COMMAND.COM
	in memory) allow the program to modify only the parent, or all the 
	parent environments.

	Respond by e-mail please, any help would be appreciated.

Doug

	For example:
	   Write a program (called X) to set a env. var. called "HOME" 
	   to whatever is on the command line.  This is what happens when
	   I wrote a test program in C.  Note the second set statement HOME
	   is NO WHERE to be found.

	C> SET 
	COMSPEC=C:\COMMAND.COM
	PATH=C:\;C:\DOS;
	PROMPT=$P $G

	C> X THIS IS A TEST
	; print current environment
	COMSPEC=C:\COMMAND.COM
	PATH=C:\;C:\DOS;
	PROMPT=$P $G
	HOME=THIS IS A TEST

	C> SET 
	COMSPEC=C:\COMMAND.COM
	PATH=C:\;C:\DOS;
	PROMPT=$P $G

- end example -

daLane (laned@athena.ecs.csus.edu) 
----------------------------------------------------------------------------
The opinions expressed are mine alone and do not reflect any 
organization unless noted.
============================================================================
"The best religion, is tolerance" 
"Take a stand, but not on my feet please." -me
----------------------------------------------------------------------------
  "Men are disturbed not by things that happen but by their opinion of
     things that happen."    Epictetus
----------------------------------------------------------------------------