/build/static/layout/Breadcrumb_cap_w.png

Retrieve Application data value (all users) - international

Hi Guys/Gals,

Anyone know of any vbscript to retrieve the all users\application data folder value for international version of windows? There is no direct env variable to this folder only for curr user.

My current code is:


varAPPDATA = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")

If objFSO.FileExists(varAPPDATA & "\Application Data\test\Software.exe") then
'Do stuff!
Else
End If


Obviously this would not work for any user with a foreign version of windows as "Application Data" is not in english.

Also, i need to detect "Start Menu\Programs"

Any Ideas?

Paul

0 Comments   [ + ] Show comments

Answers (7)

Posted by: AngelD 16 years ago
Red Belt
0
Read the paths from the registry intead as the entries are always in english.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
"Common AppData"
"Common Programs"
Posted by: HotSpot 16 years ago
Orange Senior Belt
0
Your an Angel!

Thanks, i was looking for a shell "like" scripting method but this is just as effective.. if anyone does want to retreive addition system variables then this script should put you on the right track:


Set oShell = CreateObject("Wscript.Shell")
Set oSFolders = oShell.SpecialFolders
a= oSFolders("Desktop")
b= oSFolders("AllUsersDesktop")
c= oSFolders("AllUsersStartMenu")
d= oSFolders("AppData")
msgbox a
msgbox b
msgbox c
msgbox d



PS the variable for "Common Appdata" is not available using oShell.SpecialFolders - poo really!


Paul
Posted by: anonymous_9363 16 years ago
Red Belt
0
PS the variable for "Common Appdata" is not available using oShell.SpecialFolders - poo really!So what? Just use the Shell object's RegRead method and get the information direct from the registry. :)
Posted by: HotSpot 16 years ago
Orange Senior Belt
0
Actually due to windows updates having the slight possibility of changing the values or even malware doing the same its more reliable to use the shell...


USERS_APPLICATION_DATA = &H23&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(ALL_USERS_APPLICATION_DATA)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path


Depends how paranoid you are i guess?!

Paul
Posted by: anonymous_9363 16 years ago
Red Belt
0
How do you work that out, Paul? Where would the information about 'special folders' come from, if not the registry? If I'm wrong, I'm happy to be educated :)
Posted by: AngelD 16 years ago
Red Belt
0
Ian is correct, it's all about the registry

Try using "Shell.NameSpace" instead.
Ex.
Const COMMONAPPDATA = 35
Dim Shell : Set Shell = CreateObject("Shell.Application")
Dim sCommonAppData : sCommonAppData = Shell.NameSpace(COMMONAPPDATA).Self.Path

Reference:
ShellSpecialFolderConstants Enumerated Type
http://msdn2.microsoft.com/en-us/library/ms630424.aspx
Posted by: HotSpot 16 years ago
Orange Senior Belt
0
How about in vista? the registry entries which were accesible in XP via HKEY_USERS now have (shell folders not User shell folder-they have envvar):

Key: !Do not use this registry key
Value "Use the SHGetFolderPath or SHGetKnownFolderPath function instead"

Regards

Paul
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ