Skip to main content
Inspiring
April 11, 2018
Answered

Returning Windows Environment Variables?

  • April 11, 2018
  • 1 reply
  • 1340 views

I'm trying to access my windows user variables on the machine but when I use `getenv()` or `getenv_s()` it's not returning any data....

Looking at scripting you acess them with `$.getenv()` so what would be the correct function in the C++ api?

For either Automation or Filter.

This topic has been closed for replies.
Correct answer Test Screen Name

The Windows API function is GetEnvironmentVariable or GetEnvironmentVariableW for Unicode. I would expect getenv to work too, unless you are setting the environment variable after Photoshop starts. Discussion: When What You Set is Not What You Get: SetEnvironmentVariable and getenv - CodeProject

1 reply

Test Screen NameCorrect answer
Legend
April 11, 2018

The Windows API function is GetEnvironmentVariable or GetEnvironmentVariableW for Unicode. I would expect getenv to work too, unless you are setting the environment variable after Photoshop starts. Discussion: When What You Set is Not What You Get: SetEnvironmentVariable and getenv - CodeProject

i73Author
Inspiring
April 11, 2018

Thanks TestScreen! Didn't even think of that library. No, getenv for some reason won't work with either the Automation or Listener...