查找不包含所选字符串的文件 [英] Find files which does not contains selected string
本文介绍了查找不包含所选字符串的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试查找不包含选定字符串的所有文件.查找包含的文件很容易:
I am trying to find all files, which does not contains a selected string. Find files which contains is easy:
gci | select-string "something"
但我不知道如何否定这个说法.
but I do not have an idea how to negate this statement.
推荐答案
我不确定是否可以在没有 foreach-object
的情况下完成,但这有效:
I'm not sure if it can be done without the foreach-object
but this works:
gci |foreach-object{if (-not (select-string -inputobject $_ -Pattern "something")){$_}}
这篇关于查找不包含所选字符串的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文