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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

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"
Answered 09/10/2007 by: AngelD
Red Belt

Please log in to comment
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
Answered 09/10/2007 by: HotSpot
Orange Senior Belt

Please log in to comment
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. :)
Answered 09/10/2007 by: VBScab
Red Belt

Please log in to comment
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
Answered 09/10/2007 by: HotSpot
Orange Senior Belt

Please log in to comment
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 :)
Answered 09/10/2007 by: VBScab
Red Belt

Please log in to comment
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
Answered 09/10/2007 by: AngelD
Red Belt

Please log in to comment
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
Answered 09/12/2007 by: HotSpot
Orange Senior Belt

Please log in to comment
Answer this question or Comment on this question for clarity