Listing Directory Contents in Pop up

email me

So, let’s say you want to list the contents of a specific folder, but, you want that list in a pop up. Using VBScript, you can easily direct the output of a dir command into a string, and then that output becomes a pop up.

Code

Dim oExecObject, strDir
Set oShell = CreateObject("WScript.Shell")
Set oExecObject = oShell.Exec("%comspec% /c dir /a")
Do While Not oExecObject.StdOut.AtEndOfStream
strDir = strDir & oExecObject.StdOut.Readline() & vbCrLf
Loop
WScript.Echo strDir

Output of my temp folder