Sorry I misunderstood your question. (I do hope that I haven't misunderstood it again.)

I don't think you can do what you want. There are environment shells within shells here & in a sense there there are more than 1 active current shell. If you write to the current DOS shell, I don't think you will see the results until kix completes. I also believe that shelling out to a batch set command writes to a different environment from the kix set command.

Why do you need this? If you need to pass variables within Kix why not use kix's variable space. With global variables, they will be active & clear to all segments of your script. There is no need for kix to store variables in an external space & then try to get them back.

You really only need to write to the environment if you execute 2 separate kix scripts at 2 different times & these scripts must share variables. If this is the case, the various DOS shells will collapse upon completion of the 1st script & the variable definitions will drop into the base environment. A new script starting up will be able to read these variables.

Another point, the environment is defined at start up of the new shell & expanding it to include new variables is not straight forward. If you want your variables to exist in all possible shells you should create dummy values for them before startup.

As you might be able to tell from my comments, I find the mix of kix & environment variables very hard to manage. I avoid using them whenever I can. I have a few scripts that use them but I keep it simple.

[ 13. February 2003, 00:27: Message edited by: Jack Lothian ]
_________________________
Jack