Solved

Shortcut for Common Application Folder

Posted on 2013-06-08
12
1,040 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 18

Expert Comment

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

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
 
LVL 18

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 18

Expert Comment

by:Raheman M. Abdul
ID: 39231393
0
Do email signature updates give you a headache?

Are you constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 
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 18

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 68

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now