Environment variables in an operating system are values that contain information about the system environment, and the currently logged in user. They existed in OSes before Windows as well, such as MS-DOS. Applications or services can use the information defined by environment variables to determine various things about the OS, for example, to detect the number of processes, the currently logged in user's name, the folder path to the current user's profile or the temporary files directory. In this article, we will see how to view environment variables defined for a specific process in Windows 10.
Unfortunately, I know no native way (i.e. without using third party apps) to view variables of some application running in Windows, but the Sysinternals Process Explorer does this perfectly.
- Download Process Explorer and run it as Administrator.
- Right click the process that you are interested in and choose "Properties..." from the context menu.
- The properties window for that process will appear on the screen. Switch to the Environment tab and see the complete set of variables for the selected process. This is very useful. In my screenshot, you can see a number of COMMANDER_* variables, which are available exclusively for Total Commander (the totalcmd64.exe process).
If I type "cd %commander_path%" in Total Commander's command line, it will jump into the directory where it is installed.
That's it. Now you know all the useful ways to see the names and values of variables defined for a process in your Windows 10 environment.