This checks to see if a file exists in a directory:
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\scripts\book.ps2") Then
Wscript.Echo "file exists!!"
Else
Wscript.Echo "File doesn't exist"
End If
So, the first line binds to the FileSystemObject object, then the second passes a value to the FileExists method, and the last bit determines the output.
No comments:
Post a Comment