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:
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
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)
Please log in to answer
Posted by:
AngelD
17 years ago
Posted by:
HotSpot
17 years ago
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:
PS the variable for "Common Appdata" is not available using oShell.SpecialFolders - poo really!
Paul
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
17 years ago
Posted by:
HotSpot
17 years ago
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...
Depends how paranoid you are i guess?!
Paul
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
17 years ago
Posted by:
AngelD
17 years ago
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
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
17 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.