Check if there are any *.err files

This script checks if there is any .err files in the directory. If there is any, a event is generated in the local event viewer.

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.getfolder("C:\")
For Each File in Folder.Files
If fso.GetExtensionName(File)="err" Then
Const EVENT_WARNING = 2
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_WARNING, _
"There are error files in " & folder
End If
Next

About

Microsoft