Solved

Shortcut for Common Application Folder

Posted on 2013-06-08
12
1,059 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 
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

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
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…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

740 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