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


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:
%WINDIR% Windows, default = %SYSTEMDRIVE%\Windows
%ALLUSERSPROFILE% ProgramData, default = %SYSTEMDRIVE%\ProgramData
%APPDATA% %PROFILESDIRECTORY%\{username}\AppData\Roaming
%COMMONPROGRAMFILES(x86)% %SYSTEMDRIVE%\Program Files (x86)\Common Files
%COMSPEC% %WINDIR%\System32\cmd.exe
%HOMEDRIVE% The drive where Users is located, default = C:
%PROGRAMDATA% ProgramData, default = %SYSTEMDRIVE%\ProgramData
%PROGRAMFILES(X86)% %SYSTEMDRIVE%\Program Files (x86) (only in 64-bit version)
%TEMP% and %TMP% %PROFILESDIRECTORY%\{username}\AppData\Local\Temp

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


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.

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
08 Oct 2014   #7

Windows 7 64bit SP1


You legend!!! For some reason my W7FwAS keeps assigning that variable as "%PROGRAMFILES% (x86)"
I use Windows Firewall Control for its Connections Log screen, and have noticed some rules breaking, all of them relating to the x86 Program Files folder... Swapping it to "c:\program files (x86)\" fixes things, now I will try the above mentioned version!!! So happy.

EDIT: omg, 1st post...
My System SpecsSystem Spec
17 Oct 2014   #8

Windows 7 Ultimate 64bit

OK I've landed here cause I'm still getting niggling "known folder" 1002 events, ie

Error 0x80070002 occurred while verifying known folder {b4bfcc3a-db2c-424c-b029-7fe99a87c641} with path 'C:\Windows\system32\config\systemprofile\Desktop'.
I remembered it had to do with environment variables, alas nothing in regedit - til now!

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\ contains the known folders.

Now, the interesting thing is why is this happening?

"Mikey" rightly identifies that the relative paths are broken, that the system interferes...

So I've deleted my dummy Desktop folder @ C:\Windows\System32\config\systemprofile (it didn't quash the alert I have setup for known folder issues, and was empty)

Then I remembered something: I have Windows 7 x64 ...Many of the things that are in C:\Windows\system32 in 32-bit Windows are in the 64-bit equivalent:C:\Windows\SysWOW64

Sure enough, for example, even though this was NOT there:
C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Network Shortcuts

THIS one is there(!!!)
C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\Microsoft\Windows\Network Shortcuts

So instead of putting blank folders in the incorrect places, we should find-out why Known Folders got it wrong. I will post again when I figure this the meantime, I'm open to suggestions too.
I've just noticed in environment variables this

I deleted it (UN = SYSTEM), but then chickened out and recreated it...

Everyone else has one of those there, right?

(windows 7 ultimate x64)

back to the test...
My System SpecsSystem Spec
17 Oct 2014   #9

Windows 7 Ultimate 64bit

Got the alert, re the event

The suspected culprit

comparing ...
My System SpecsSystem Spec
17 Oct 2014   #10

Windows 7 Ultimate 64bit

same relative path on folder build, not affected by Desktop, but instead littered with some burn1 nonsense.

Making a note of my dummy syswow64 for comparison in new builds - the timedatestamps don't help - they make me think I've created them manually as a workaround...

back to the new builds...
My System SpecsSystem Spec

 Windows 7 Environment Variables List

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar help and support threads
Thread Forum
Environment Variables
Hi I set up a User defined Enviro. Var. called GomFolder to be C:\Users|Damo\MyDocuments\NinjaTrader 7 See the attached clip 2015-01-23_1242 - Judge101010's library My understanding is that this should set up a folder called GomFolder in the NinjaTrader 7 folder. Is this correct? If...
General Discussion
Search for environment variables return no results
Hi all, I am a new guy on this forum. I have been using this forum as a resource for many years (going back to the XP and Vista days), there are tons of useful information here. In all these years I never had a question for which I had to register and ask it to you guys. Until now...... ...
General Discussion
Windows 7 Environment variables
Is there an Environment variable that can tell me where the Documents folder is located? Typically, the Documents folder is located in C:\Users\username\Documents. I am creating a batch file to copy 1 file from a remote location (another computer in the network) to the Documents folder. Since...
General Discussion
What are Environment Variables in Computer?
Hey, Can anyone explain are environment variables are within the Advanced System Settings of Computer? I've had to create a new environment variable for a Java complier, and I was just wondering what exactly are environment variables are and why are they used? Thanks, Harry P.S I've...
General Discussion
Java, Windows 7 & Environment Variables
I have installed Java in Program Files (x86) > Java > jre > bin In Environment Variables, I accidentally deleted the default PATH variable. This is what I currently have in the PATH variable: Please can someone tell me what the default PATH was? I will add this in front of the Java path. ...
Windows doesn't seem to keep my system environment variables
Hi all, As far as I can tell, my problem seems to be quite simple. The solution, however, may not be quite as simple. The application I am trying to make work is python 3. I also have python 2 installed, but that works fine. The problem is at the command prompt I would like to be able to...
Performance & Maintenance

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 22:48.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App