• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6784
  • Last Modified:

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

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
acrocat
Asked:
acrocat
  • 2
  • 2
1 Solution
 
MorDrakkaCommented:
Hi,

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

Hope this helps.
0
 
acrocatAuthor Commented:
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
 
MorDrakkaCommented:
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
 
acrocatAuthor Commented:
Yep - looks like this is the best/only way.

Thanks!
0
 
janpjensCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now