How to get program files environment setting from VBScript
31,052
Solution 1
Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
Solution 2
To get Program Files (x86) use:
Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")
Comments
-
Jeremy almost 4 years
In a batch file you can use %PROGRAMFILES% to get the location of the program files directory, how do you do it in a VBScript?
-
Jeremy over 14 yearsNice, thanks. I have been resorting to reading the registry, but your answer is far better. Thanks.