#39261 - 2003-04-16 03:55 PM
Re: Output from a command to a Environment Variable (SET)
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
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.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1336 anonymous users online.
|
|
|