开发者

View environment variable of process on Windows

How do I view the environment variable of a Windows process? Looking for Windows equivalent for something like environ开发者_运维技巧 file in procfs on Unix.


Process Explorer or one of its friends should help.


Check out GetEnvironmentStrings.


As ziya suggests, you can use the SysInternal's Process Explorer or, for example, slighly more feature rich Process Hacker.

Even though it's really trivial, I'll describe how to find the environment variables used by a specific process in any of those two applications:

  1. in the list of running processes, select the process you're interested in (in Process Hacker or Process Explorer 16.40 and newer, you can use the search box on the main toolbar)
  2. open the process' Properties dialog (double-click, press Enter or click Properties in the contect menu)
  3. open the Environment tab

Process Explorer is displaying all environment variables in a single list, but Process Hacker organizes them into three sections by their scope:

  1. Process: environment variables specific to the current process (e.g. passed from the command line or defined during the process creation
  2. User: environment variables defined for the user who owns the process
  3. System: system-wide environment variables shared by all processes


Take a look at the _environ variable.


To get process environment, you must be able to obtain its context. And within the context, use getenv() to get specific variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜