The following script snippet is handy at checking whether a folder exists or not at Window Script Hosting Environment using VBScript.
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("C:\FSO") Then
Set objFolder = objFSO.GetFolder("C:\FSO")
Else
Wscript.Echo "Folder does not exist."
End If
The following does the same thing, if you prefer MS JScript Engine.
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
if (objFSO.FolderExists("C:\\FSO")) {
var objFolder = objFSO.GetFolder("C:\\FSO");
} else {
WScript.Echo ("Folder does not exist.");
}
–EOF (The Ultimate Computing & Technology Blog) —
115 wordsLast Post: Variable Scopes in VBScript at Windows Script Host
Next Post: Codeforces: A. Circle Line