tags:

views:

29

answers:

2

ho to verify by VB script syntax if the file conf C:\Program Files\conf exist under Program Files ?

for example if it exist then msgBox print file exist if not the msgBox print file not exist THX

+2  A: 

There is no built-in functionality in VBS for that, however, you can use the FSO object for that:

Option Explicit
DIM fso    
Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists("C:\Program Files\conf")) Then
  WScript.Echo("File exists!")
  WScript.Quit()
Else
  WScript.Echo("File does not exist!")
End If

WScript.Quit()
Sarfraz
The `WScript.Quit` method calls in your example are absolutely unnecessary.
Helen
A: 

see the FileSystemObject

renick