Solved

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

Posted on 2007-11-14
5
6,663 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like 192.168.xxx.1, I've seen routers with default values of: 192.168.0.1, 192.168.1.1, 192.168.11.1, …
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!    …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

920 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

13 Experts available now in Live!

Get 1:1 Help Now