Something's gone wrong!An error ocurred performing that action. Please try refreshing the page.

Environment variables

By Katy Nicholson, posted on 14 August, 2020

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.

VariableDefault
%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

Support My Work

I hope you find my content useful. Please consider tipping to support the running costs of hosting, licensing etc on my Ko-fi page.

Support me on Ko-fi

Search