How to get Desktop, MyDocuments, ProgramFiles & Temp directories path at runtime?
This is possible using DotNetFactory and WScript.
DotNetFactory
Function GetDirectoryPath(ByVal strDirName) Dim oSpecialDir Set oSpecialDir=DotNetFactory.CreateInstance("Microsoft.VisualBasic.FileIO.SpecialDirectories","Microsoft.VisualBasic") Execute "GetDirectoryPath=oSpecialDir."&strDirName Set oSpecialDir=Nothing End Function Msgbox GetDirectoryPath("Desktop")
WScript
Dim WSHShell:Set WSHShell = CreateObject("WScript.Shell") Msgbox WSHShell.SpecialFolders("Desktop")
Comments(0)