I have a PS question and forgive me as I am relatively new to PS. If I wanted to utilize PS to search a system for all files with a specific file type such as *.text as an example and search those files for a specific string of characters and pull any "True" or "False" statements for if the strings were found within each file located. What would be the best way to accomplish this.
If you want to just display files under a certain path (recursively), and show only the files that match without including duplicates, then something like this will should work for you. The reason for the "Sort-Object -Unique" part has to do with matching multiple lines in the same file.
Really, this would be better served as a function or advanced function, especially if you truly need to know which files return 'False' since they do not contain the pattern. I'm not sure what your exact use case is, but conceptually, you may want to start and experiment with this pattern. If this falls short, then post how it does and someone may be able to help.
The topic ‘Search for String of text from specific file types’ is closed to new replies.