Get Special Directories - Codoid
Select Page
Codoid Blog

Get Special Directories

Irrespective of the business that your client is in, marketing is an integral part of their operations. In fact, in this day and age of social.

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")
  

Written By

Submit a Comment

Your email address will not be published. Required fields are marked *


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")