【发布时间】:2014-07-14 12:16:07
【问题描述】:
我正在使用 C# 开发 WMI(Windows Management Instrumentation),但遇到了问题。
我必须使用类似于 File System Watcher 的 WMI (C#) 创建一个应用程序。
我希望每次在特定文件夹中创建或删除新文件时都能收到通知。
我的 WQL 查询是:
SELECT * from _InstanceModificationEvent within 2 where TargetInstance ISA 'CIM_DataFile' and TargetInstance.Drive = 'C:' AND TargetInstance.Path='\\Test'
在使用 wbemtest 运行查询时,它会显示一条错误消息,提示 Invalid Class。
有人可以帮我解决同样的问题吗?
【问题讨论】:
-
_InstanceModificationEvent中的错字吗?应该有 2 个下划线作为前缀。 -
是的,谢谢,而且查询必须在通知查询中运行,而不是作为简单查询。但是进程仍然挂起而不是执行。您能提供一些解决方案吗??