Solved

Shortcut for Common Application Folder

Posted on 2013-06-08
12
1,084 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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 70

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

691 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