Why does the set command display more environment variables than the environment variables gui?

1

When I run the set command in command prompt the first variable I see is

enter image description here

But when I open my Environment Variables GUI I don't see ALLUSERSPROFILE

enter image description here

enter image description here

Why is that? There are numerous other variables listed in set that don't show up in the GUI as well. Shouldn't they all show the same info?

David says Reinstate Monica

Posted 2015-05-03T19:13:41.057

Reputation: 952

It is not uncommon on many operating systems to only include common config option in the GUI for standard users and expect that advanced users who would more likely need the less standard options will prefer the command line for their work. – MaQleod – 2015-05-09T18:41:44.980

Answers

2

After a bit of trial and error, I discovered that these environment variables are the additional ones reported by SET on my Windows 8.1 system:

ALLUSERSPROFILE
APPDATA
CommonProgramFiles
CommonProgramFiles(x86)
CommonProgramW6432
COMPUTERNAME
HOMEDRIVE
HOMEPATH
LOCALAPPDATA
LOGONSERVER
ProgramData
ProgramFiles
ProgramFiles(x86)
ProgramW6432
PROMPT
PUBLIC
SESSIONNAME
SystemDrive
SystemRoot
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE

I suspect that they are all automatically generated and updated by Windows, which is probably why I couldn't find some of them listed anywhere in Windows Registry.

I know that HOMEDRIVE, HOMEPATH and HOMESHARE are updated automatically from this TechNet Forums post.

I tried permanently changing the PROMPT variable to something other than $P$G (which is the default) using SETX and noticed that it created a new PROMPT environment variable in the User variables for <username> section in the Environment Variables GUI.

On deleting that variable, my prompt was reset back to $P$G. I noticed the same behavior with COMPUTERNAME environment variable.

The same goes for:

PROCESSOR_ARCHITECTURE
ProgramFiles
ProgramW6432
CommonProgramFiles
CommonProgramW6432

as explained in this MSDN article about WOW64 Implementation Details.

Vinayak

Posted 2015-05-03T19:13:41.057

Reputation: 9 310

1

According to SS64.com (Autoexec.bat section), those variables may be boot-time variables, that are "not available to 32 bit gui programs". Since Windows XP, boot-time environment variables should be set with the registry in:
HKEY_CURRENT_USER\Environment (USER environment variables) or:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment(SYSTEM environment variables)
as shown in Microsoft's KB

RetroDroid

Posted 2015-05-03T19:13:41.057

Reputation: 73