就是比如一个文件夹下放置的是ntbackup的备份文件,如果每日备份完毕后,会有新的日志文件增加,或者覆盖旧的文件,怎样才能监测到这个事件的发生,并输出这个日志文件呢(.log文件)
VBS刚刚开始看,遇到了不少问题,自己尽力解决尽量不劳烦高手,但是这些实在弄了很长时间没有完成的,希望高手能帮帮忙!在此先谢过了!底下的是源代码,但是看的不太懂。- strComputer = "."
- Set objWMIService = GetObject("winmgmts:" _
- & "{impersonationLevel=impersonate}!\\" & _
- strComputer & "\root\cimv2")
- Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
- ("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
- & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
- & "TargetInstance.GroupComponent= " _
- & "'Win32_Directory.Name=""c:\\\\scripts""'")
- Do
- Set objLatestEvent = colMonitoredEvents.NextEvent
- Wscript.Echo objLatestEvent.TargetInstance.PartComponent
- Loop
复制代码
|