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?
Asked
Active
Viewed 3.2k times
2 Answers
17
Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")

Jonas Elfström
- 30,834
- 6
- 70
- 106
-
Nice, thanks. I have been resorting to reading the registry, but your answer is far better. Thanks. – Jeremy Dec 12 '09 at 18:05
7
To get Program Files (x86) use:
Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")

Bizmarck
- 2,663
- 2
- 33
- 48