特殊フォルダーのパスを取得するVBScript

Option Explicit

'ShellSpecialFolderConstants
'http://msdn.microsoft.com/en-us/library/windows/desktop/bb774096.aspx
Private Const ssfDESKTOP = 0
Private Const ssfPROGRAMS = 2
Private Const ssfCONTROLS = 3
Private Const ssfPRINTERS = 4
Private Const ssfPERSONAL = 5
Private Const ssfFAVORITES = 6
Private Const ssfSTARTUP = 7
Private Const ssfRECENT = 8
Private Const ssfSENDTO = 9
Private Const ssfBITBUCKET = 10
Private Const ssfSTARTMENU = 11
Private Const ssfDESKTOPDIRECTORY = 16
Private Const ssfDRIVES = 17
Private Const ssfNETWORK = 18
Private Const ssfNETHOOD = 19
Private Const ssfFONTS = 20
Private Const ssfTEMPLATES = 21
Private Const ssfCOMMONSTARTMENU = 22
Private Const ssfCOMMONPROGRAMS = 23
Private Const ssfCOMMONSTARTUP = 24
Private Const ssfCOMMONDESKTOPDIR = 25
Private Const ssfAPPDATA = 26
Private Const ssfPRINTHOOD = 27
Private Const ssfLOCALAPPDATA = 28
Private Const ssfALTSTARTUP = 29
Private Const ssfCOMMONALTSTARTUP = 30
Private Const ssfCOMMONFAVORITES = 31
Private Const ssfINTERNETCACHE = 32
Private Const ssfCOOKIES = 33
Private Const ssfHISTORY = 34
Private Const ssfCOMMONAPPDATA = 35
Private Const ssfWINDOWS = 36
Private Const ssfSYSTEM = 37
Private Const ssfPROGRAMFILES = 38
Private Const ssfMYPICTURES = 39
Private Const ssfPROFILE = 40
Private Const ssfSYSTEMx86 = 41
'Private Const ssfPROGRAMFILESx86 = 48 '48だと管理ツール
Private Const ssfPROGRAMFILESx86 = 42

'Program Filesフォルダーのパス表示
MsgBox CreateObject("Shell.Application").Namespace(ssfPROGRAMFILES).Self.Path

ネタ元