Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get program files environment setting from VBScript

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?

like image 531
Jeremy Avatar asked Dec 11 '09 22:12

Jeremy


2 Answers

Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
like image 72
Jonas Elfström Avatar answered Nov 20 '22 02:11

Jonas Elfström


To get Program Files (x86) use:

Set wshShell = CreateObject("WScript.Shell")
WScript.Echo wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")
like image 29
Bizmarck Avatar answered Nov 20 '22 02:11

Bizmarck