Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-08

Environment variable list

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Chris Kelling

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.

-Chris

Information in this message is intended for sole use of the recipient unless otherwise noted.

Reply by email

Sven Barth
to Chris Kelling

Stupid question on my side just to check whether I've understood you correctly: *are* you blind?

Regarding your problem: use GetEnvironmentVariableCount and GetEnvironmentString from unit SysUtils.

Regards,
Sven

Chris Kelling 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.

Reply by email

Mattias Gaertner
to Chris Kelling: This could be a totally stupid question, but I'm trying to do this blind. Is there a way…
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

Reply by email

Chris Kelling

I knew there was something for what I needed. Thank you, and no, not blind except maybe selectively.

Information in this message is intended for sole use of the recipient unless otherwise noted.

Sven Barth wrote 16 lines
Stupid question on my side just to check whether I've understood you correctly: *are* you blind? Regarding your problem: use GetEnvironmentVariableCount and GetEnvironmentString from unit SysUtils. Regards, Sven On 21.08.2013 18:50, Chris Kelling 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. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Sven Barth
to Chris Kelling
Chris Kelling wrote
I knew there was something for what I needed. Thank you, and no, not blind except maybe selectively.

I was confused by your "but I'm trying to do this blind". As we already had some questions from really blind people I wanted to be sure :) (that's also why I top posted, because blind people normally use screen readers which would repeat the quote again if I'd do an inline posting...)

Regards,
Sven

Reply by email