Question:
How can I create and view a Windows folder via scripts?
Solution:
To do so, you must create a script similar to the following example:
Set fso = CreateObject(“Scripting.FileSystemObject”)
newfolder = InputBox(“Type here the new Directory name:” & Chr(13) & Chr(10) & Chr(13) & Chr(10) &”Eg: C:\NewFolder”, “Directory name”)
If (fso.FolderExists(newfolder)) Then
If MsgBox (“The Directory ‘” & newfolder & “‘ already exists. Do you want to view the directory?”,52,”Directory already exists”) = 6 then
Application.ExecuteExternalApp explorer,””, newfolder,9
End If
Else
If MsgBox (newfolder & ” does not exist. Do you want to create it?”, 52,”Create Directory”) = 6 then
fso.CreateFolder(newfolder)
If MsgBox (“Do you want to view the directory?”, 52,”Open directory”) = 6 then
Application.ExecuteExternalApp explorer,””, newfolder,9
End If
End If
End If