Environment variables

Environment variables are really useful when doing scripts, folder redirection or GPP items

As I’ve been configuring a bit of folder redirection in group policies, I often forget what environment variables there are (there’s a lot more than you ever realise!) So I thought I’d list some environment variables that may be useful when editing GPOs or registry settings, and what they resolve to by default (assuming I’m logged in to the domain contoso.com as CONTOSO\Katy from contoso-wk-1), with my home drive set to map N: to \\file.contoso.com\users\katy

You can view the full list of environment variables for the currently logged on user on your system by opening a command prompt and running “set”. You can also see them by going into System Properties -> Advanced -> Environment Variables however this will show you the variables in the SYSTEM context, i.e. %USERNAME% will show as SYSTEM.

Variable Default
%USERNAME% Katy
%USERDOMAIN% CONTOSO
%USERDNSDOMAIN% contoso.com
%HOMEDRIVE% N:
%HOMESHARE% \\file.contoso.com\users\katy
%HOMEPATH% \
%COMPUTERNAME% contoso-wk-1
%ONEDRIVE% C:\Users\katy\OneDrive – Contoso
%USERPROFILE% C:\Users\katy
%APPDATA% C:\Users\katy\AppData\Roaming
%LOCALAPPDATA% C:\Users\katy\AppData\Local
%ALLUSERSPROFILE% C:\ProgramData
%TEMP% C:\Users\katy\AppData\Local\Temp

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.