Windows Script Host

From SkobbaPedia

Jump to: navigation, search

[edit] VBScript

Set the default script host

wscript //H:cscript

Run the script without header

cscript //NoLogo myscript.vbs


Option Explicit 
Dim numFolders
Dim folderPath
Dim folderPrefix
Dim objFSO
Dim objFolder
Dim i
numFolders = 10
folderPath = "F:\Development\VBScript\parentFolder"
folderPrefix = "Student"
For i = 1 To numFolders
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(folderPath & folderPrefix & i) Then
WScript.Echo(folderPath & folderPrefix & i & " exists.")
objFSO.DeleteFolder(folderPath & folderPrefix & i)
WScript.Echo(folderPath & folderPrefix & i & " was deleted")
Else
WScript.Echo(folderPath & folderPrefix & i & " does not exist")
End If
Next


[edit] Div. Syntax

Personal tools