Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: Windows 7 Environment Variables List

07 Jan 2011   #1

Windows 7 Home Premium x64
 
 
Windows 7 Environment Variables List

Environment Variable Path
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users\{username}\AppData\Roaming
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
%COMSPEC% C:\Windows\System32\cmd.exe
%HOMEDRIVE% C:
%HOMEPATH% C:\Users\{username}
%LOCALAPPDATA% C:\Users\{username}\AppData\Local
%PROGRAMDATA% C:\ProgramData
%PROGRAMFILES% C:\Program Files
%PROGRAMFILES(X86)% C:\Program Files (x86) (only in 64-bit version)
%PUBLIC% C:\Users\Public
%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% and %TMP% C:\Users\{username}\AppData\Local\Temp
%USERPROFILE% C:\Users\{username}
%WINDIR% C:\Windows

NOTE: C:\ is the system drive (ie, where Windows is installed). It will differ if you installed Windows to a different drive.

My System SpecsSystem Spec
.

07 Jan 2011   #2

Microsoft Community Contributor Award Recipient

Windows 8.1 Pro Preview with Media Center
 
 

This list is of course valid only if, as you mentioned, Windows is installed in C: AND you have not moved or relocated any of the folders created by Windows installation. For instance in my case I have Windows installed in C: but I have relocated both Users and ProgramData to D:, so half of those variables in your list are wrong in all my computers.

Variable Refers to folder or drive
%SYSTEMDRIVE% The drive / partition where Windows is installed, default = C:
%PROFILESDIRECTORY% Users, default = %SYSTEMDRIVE%\Users
%WINDIR% Windows, default = %SYSTEMDRIVE%\Windows
  
%ALLUSERSPROFILE% ProgramData, default = %SYSTEMDRIVE%\ProgramData
%APPDATA% %PROFILESDIRECTORY%\{username}\AppData\Roaming
%COMMONPROGRAMFILES% %SYSTEMDRIVE%\Common Files
%COMMONPROGRAMFILES(x86)% %SYSTEMDRIVE%\Program Files (x86)\Common Files
%COMSPEC% %WINDIR%\System32\cmd.exe
%HOMEDRIVE% The drive where Users is located, default = C:
%HOMEPATH% %PROFILESDIRECTORY%\{username}
%LOCALAPPDATA% %PROFILESDIRECTORY%\{username}\AppData\Local
%PROGRAMDATA% ProgramData, default = %SYSTEMDRIVE%\ProgramData
%PROGRAMFILES% %SYSTEMDRIVE%\Program Files
%PROGRAMFILES(X86)% %SYSTEMDRIVE%\Program Files (x86) (only in 64-bit version)
%PUBLIC% %PROFILESDIRECTORY%\Public
%SYSTEMROOT% %WINDIR%
%TEMP% and %TMP% %PROFILESDIRECTORY%\{username}\AppData\Local\Temp
%USERPROFILE% %PROFILESDIRECTORY%\{username}

Kari
My System SpecsSystem Spec
07 Jan 2011   #3

Windows 7 Home Premium x64
 
 

All right- let me ask you this:
When you move those folders, doesn't Windows update those associated paths?
My System SpecsSystem Spec
.


07 Jan 2011   #4

Microsoft Community Contributor Award Recipient

Windows 8.1 Pro Preview with Media Center
 
 

Depending on how you do it. Normally yes.

I just wanted to point out that saying that for instance %APPDATA% is C:\Users\{username}\AppData is not necessarily true, even if C: is your system drive. That's why a list of variables is more truthfully presented when we first establish location of %SYSTEMDRIVE%, %PROFILESDIRECTORY% and %WINDIR%, and then present other locations in relation to these.

Kari
My System SpecsSystem Spec
07 Jan 2011   #5

Windows 7 Home Premium x64
 
 

Point taken...
Thanks for clearing that up for me...
My System SpecsSystem Spec
20 Jun 2013   #6

Windows 7 Ultimate 32bit
 
 

can you provide examples of use of the variables in code, say in c++ for example? and how to edit them in windows? and are there any "hidden" or "secret" variables?
My System SpecsSystem Spec
Reply

 Windows 7 Environment Variables List





Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:30 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33