我正在使用Sysinternals Process Monitor调试一些传入事件,现在我尝试在路径上创建一个过滤器并使用通配符。我试图使用的是过滤以 c:\MyApp\MyDocuments\Temp 开头并以 .pdf 结尾的路径
路径过滤器应如下所示:c:\MyApp\MyDocuments\Temp*.pdf
我该怎么做?
最佳答案
当你有两个像这样的过滤器时:
路径
开头为
c:\MyApp\MyDocuments\Temp
路径
结尾为
.pdf
所发生的情况是包含以该临时文件夹开头的任何内容,并且包含记录 .pdf 事件的其他任何位置,因此您将得到不想要的结果。像这样的东西:
C:\MyApp\MyDocuments\Temp.txt (not a PDF)
C:\Some\Other\Folder\file.pdf (not the folder I want)
进程监视器帮助文件解释了为什么开头为/结尾为过滤器不能一起工作。来自帮助文件:
Process Monitor ORs together all the filters that are related to a particular attribute type and ANDs together filters of different attribute types. For example, if you specified process name include filters for Notepad.exe and Cmd.exe and a path include filter for C:\Windows, Process Monitor would only display events originating in either Notepad.exe or Cmd.exe that specify the C:\Windows directory.
因此,因为过滤器实体对于“开头为”和“结尾为”都是“路径”,所以进程监视器对它们进行 OR 运算,因此我们得到了我们不想要的噪音。这是一个按我们想要的方式工作的过滤器组合:
路径
以
结尾.pdf
包含
路径
排除
C:\MyApp\MyDocuments\Temp
排除
关于Sysinternals 进程监视器 (ProcMon) : Using wildcards on filter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64172904/