As Les has intimated this is to do with environment variable scope, and is not specific to KiXtart, indeed it will happen with DOS shells.

Try the following:
  • Open a command line (DOS) window.
  • Type "SET VAR1=foo"
  • Type "SET" - you will see your VAR1
  • Type "%COMSPEC%" - this will start a new interpreter.
  • Type "SET VAR2=bar"
  • Type "SET" - you will see both VAR1 and VAR2
  • Type "exit" - this will close the top level interpreter
  • Type "SET" - You will only see your VAR1 environment variable.
This happens because environment variables are copied to new environments (inherited), but cannot change the environment of the process that started them.
When you "SHELL" or "RUN" a command a new environment is created. This environment can inherit environment variables from its parent, but cannot change its parents environment.

You can always echo the result to a file and read the file in KiXtart if you wish.