Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi

Bind to a Folder Using the Browse for Folder Dialog Box in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

Bind to a Folder Using the Browse for Folder Dialog Box in Windows using VBScript, WMI and LDAP

Example(s)

Const WINDOW_HANDLE = 0
Const NO_OPTIONS = 0

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder _
    (WINDOW_HANDLE, "Select a folder:", NO_OPTIONS, "C:\Scripts")       
Set objFolderItem = objFolder.Self

objPath = objFolderItem.Path
objPath = Replace(objPath, "\", "\\")

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("Select * from Win32_Directory where name = '" & objPath & "'")

For Each objFile in colFiles
    Wscript.Echo "Readable: " & objFile.Readable
Next