On Wed, 21 Aug 2013 12:50:01 -0400
Chris Kelling <[email protected]> wrote:

> This could be a totally stupid question, but I'm trying to do this blind. Is 
> there a way to get a list if environment variables defined at run time?  
> There is a get and set, but I don't know the name of the variable I need, so 
> I want to get a list. This should work cross platform, I think. 

Getting the list of environment strings, i.e. name=value pairs:

  SysVarCount:=GetEnvironmentVariableCount;
  for i:=0 to SysVarCount-1 do begin
    Variable:=GetEnvironmentStringUTF8(i+1);
    
  end;

Get a specific value:

Value:=GetEnvironmentVariableUTF8(VariableName);

The UTF8 functions are defined in lazutf8, others are in SysUtils.

Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to