Adrian Maier wrote: > So, initially the Environment is empty and the program inherits the > variables. > When I append the first variable, it will no longer inherit the variables. > > I find the behaviour counterintuitive: the first "append" causes the > Environment to > be initialised. > > I haven't discovered yet how could the programmer preserve the > inherited environment > and only "add" some variables ?
This copies all the envvars to a stringlist. You can add your own of course too. function GetEnvironmentVars: TStringList; var I: Integer; fName: String; begin Result := TStringList.Create; for I := 0 to GetEnvironmentVariableCount-1 do begin fName := GetEnvironmentString(I); Result.Add(fName); end; end; HTH Andrew Haines _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal