Solved

Environment variable for C:\Documents and Settings\All Users\Application Data

Posted on 2007-11-14
5
6,675 Views
Last Modified: 2010-04-21
For Windows, how can I get the path:

C:\Documents and Settings\All Users\Application Data

via an environment variable?

"%ALLUSERSPROFILE%" gets me to: C:\Documents and Settings\All Users but I need: C:\Documents and Settings\All Users\Application Data

Any ideas?
0
Comment
Question by:acrocat
[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
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:MorDrakka
ID: 20287245
Hi,

You can use: %ALLUSERSPROFILE%\Application Data\ or create one environment variable of your own.

Hope this helps.
0
 

Author Comment

by:acrocat
ID: 20287275
Problem is that \Application Data is not "Application Data" on a French or Italian machine etc... so that solution doesn't scale to other versions of the OS.
0
 
LVL 6

Accepted Solution

by:
MorDrakka earned 500 total points
ID: 20287324
Hi,

After extensive searching, I have come to the conclusion that "C:\Documents and Settings\All Users\Application Data" is no standard environment variable. So you can either set is as one, or find out which language the OS is in your script.

Maybe something like:

If Exist %ALLUSERSPROFILE%\Application Data\  echo English
If Exist %ALLUSERSPROFILE%\Application Data(en Francais)\  echo French
Instead of the echo i wrote here, you can do some action you want to do in your script.

M.
0
 

Author Closing Comment

by:acrocat
ID: 31409288
Yep - looks like this is the best/only way.

Thanks!
0
 

Expert Comment

by:janpjens
ID: 22139966
In case anyone else are looking for a way to retrieve localized version of %ALLUSERSPROFILE%\Application Data:

You could retrieve the value of %APPDATA%, substring anything after the last \ and append it to %ALLUSERSPROFILE%, then store this in a new environment variable, say %ALLUSERSAPPDATA%.
I know it's not nice, but it should do the trick.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
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…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

724 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