Presuming you're using ActiveState's port, Look in the Win32 (not Win32::API) module for Win32::ExpandEnvironmentStrings(STRING) To quote the documentation:
[EXT] Takes STRING and replaces all referenced environment variable names with their defined values. References to environment variables take the form %VariableName%. Case is ignored when looking up the VariableName in the environment. If the variable is not found then the original %VariableName% text is retained. Has the same effect as the following:
$string =~ s/%([^%]*)%/$ENV{$1} || "%$1%"/eg
back to swampyankee...
Incidentally, the built-in %ENV hash should work, except that hashes are case sensitive, but Windows' environment variables are not: $ENV{fred} and $ENV{FRED} are not the same hash elements, but Win32::ExpandEnvironmentStrings('fred') will refer to the same variable as Win32::ExpandEnvironmentStrings('FRED').
Update: Thanks to ikegami for pointing out that %ENV is magical, at least on Windows
emc
At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.
—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.In reply to Re: Win32 GetEnvironmentVariables?
by swampyankee
in thread Win32 GetEnvironmentVariables?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |