Jump to Real's How-to Main page

Get the "Program Files" path

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

If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]