Share this page 

Get the "Program Files" pathTag(s): WSH VBScript


Set oShell = CreateObject("WScript.Shell")
Set oProcEnv = oShell.Environment("PROCESS")

sProgramFiles = oProcEnv("ProgramFiles")

If sProgramFiles = "" Then
  sProgramFiles = oShell.RegRead _
     ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir")
End If

WScript.Echo sProgramFiles