Solved

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

Posted on 2007-11-14
5
6,660 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
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:MorDrakka
Comment Utility
Hi,

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

Hope this helps.
0
 

Author Comment

by:acrocat
Comment Utility
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
Comment Utility
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
Comment Utility
Yep - looks like this is the best/only way.

Thanks!
0
 

Expert Comment

by:janpjens
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

762 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

6 Experts available now in Live!

Get 1:1 Help Now