Page 1 of 1

Get Program Files path

PostPosted: Thu Mar 08, 2012 10:10 am
by smokinbanger
How do I get the Special Folders "Program Files" path with vbscript?
I'm trying to use this code but I think I'm missing something:
Code: Select all
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

Dim ProgramFiles

' Read proram files path using WshSpecialFolders object
ProgramFiles = WSHShell.SpecialFolders("Program Files")

'send the results to a NeoBook variable
publication.nbSetVar "[%ProgramFiles]", ProgramFiles

Also does it work with most versions of windows (XP, Vista, Win7)?

PostPosted: Thu Mar 08, 2012 10:34 am
by HPW
What about predefined var [ProgramFiles]?

PostPosted: Thu Mar 08, 2012 4:29 pm
by smokinbanger
HPW wrote:What about predefined var [ProgramFiles]?

Oops! I forgot about that! I think I need to get out and get some fresh air!