Solved

Shortcut for Common Application Folder

Posted on 2013-06-08
12
1,046 Views
Last Modified: 2013-06-09
What is the shortcut for Common Application Data Folder?

e.g.
%temp% - temporary file folder
%systemroot% - windows folder
0
Comment
Question by:Thomasian
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39231271
%APPDATA%
0
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39231273
List of them:
%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
0
 
LVL 22

Author Comment

by:Thomasian
ID: 39231275
%APPDATA% is differnt.

In windows 7, it shows "C:\Users\UserName\AppData\Roaming"
While the common application data folder should be "c:\ProgramData"

Please check link in question for details about common app data folder.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 19

Assisted Solution

by:Raheman M. Abdul
Raheman M. Abdul earned 167 total points
ID: 39231277
Then its: %PROGRAMDATA% ------------------------C:\ProgramData

to see all the environment variables type:
c:\> SET (enter)
0
 
LVL 22

Author Comment

by:Thomasian
ID: 39231283
%ProgramData% does not work on WinXP

I tried Set but the list doesn't include "c:\Documents and Settings\All Users\Application Data".

Does the command list all available shortcuts?
0
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39231393
0
 
LVL 22

Author Comment

by:Thomasian
ID: 39231453
Haven't tried it in WinXP yet but it doesn't work on Win7
0
 
LVL 16

Assisted Solution

by:cantoris
cantoris earned 166 total points
ID: 39231540
I know what you're wanting to do but don't know of a built-in easy way.
You could do this in a batch file - as long as you're happy with its path assumptions:
if exist c:\users (
   set AllUsersAppData=c:\ProgramData
) else (
   set AllUsersAppData=c:\Documents and Settings\All Users\Application Data
)

Open in new window

Or in VBScript using a safer method:
Const COMMONAPPDATA = &H23&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(COMMONAPPDATA)
Set objFolderItem = objFolder.Self
strAllUsersAppData = objFolderItem.Path

Open in new window

0
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39231915
In windows 7 : %APPDATA%
In winXP : %CSIDL_COMMON_APPDATA%
0
 
LVL 16

Expert Comment

by:cantoris
ID: 39231938
%AppData% is the current user's application data, not the common one.

CSIDL_COMMON_APPDATA is not an environment variable under Windows 7 or XP.  It's a special folder location used within the shell by developers.
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 167 total points
ID: 39232814
As the linked article suggests, one should use %ProgramData%, and only if that one does not exist (i.e. XP, 2003 and earlier), fall back to %AllUsersProfile%, but with a modification. The following code will "implement" a ProgramData var if it does not exist.
@echo off
if not defined ProgramData for %%A in ("%AppData%") do set ProgramData=%AllUsersProfile%\%%~nxA

Open in new window

I'm not appending "Application Data" because that is a localized name, and different for non-english countries.
Using the reg method is more save, should the folder have been changed to something completely different:
@echo off
if not defined ProgramData for /F "tokens=3*" %%A in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Common AppData"') do set ProgramData=%%B

Open in new window

0
 
LVL 22

Author Closing Comment

by:Thomasian
ID: 39233719
Thanks
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question