1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| strComputer = "."
strDirPath = "c:\\chemin du profil"
strFile = "*837i*.dat "
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
wscript.echo "File: " & strFile
strFile = Replace(strFile,"*", "%")
wscript.echo "NewFile: " & strFile
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_Datafile where Path = '" & strDirPath & "' and Name = '" & strFile & "'")
if colFiles.Count > 0 Then
wscript.echo "Found files: " & colFiles.Count
Wscript.Quit
Else
Wscript.Echo "The file does not exist."
End If |
Partager