试试这个:
Private Declare Function SHFileExists Lib "shell32" Alias "#45" (ByVal szPath As String) As Long
Private Sub Command1_Click()
Dim i As Integer
i = Str$(SHFileExists(Text1.Text))
If i = 0 Then 'Str$值只有两种可能,0或者1
Text2.Text = "文件不存在"
Else
Text2 = "文件存在"
End If
End Sub
On Error Resume Next
Set ofs=Wscript.CreateObject("Scripting.FilesystemObject")
Set oFile=ofs.GetFile("C:\MyDb.ldb")
If Err.Number = 0 Then
Wscript.echo "File found"
Else
Wscript.echo "File not found"
End If