KB-36351: Creating and viewing a folder via scripts.

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

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Deixe seu Comentário

Seu endereço de e-mail não será publicado. Campos marcados com asterisco são obrigatórios *