KB-31537: Verifying the existence of a certain file.

Question:

How can I create a script that checks whether a certain file exists in a specific folder?

Solution:

To do so, you can use a script similar to the following:

Set fso = CreateObject(“Scripting.FileSystemObject”)
If fso.FileExists(“C:\file.txt”) Then
MsgBox “This file already exists!”
Else
MsgBox “File not found!”
End If
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

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

Leave a Reply

Your email address will not be published.Required fields are marked *