Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, January 21, 2020 10:29 AM
I wanted to get clarification whether the file extension affects Windows Explorer search results.
For example, I have a directory "A" which contains several dozens of files with .xml extension.
I know, that some of these files' contents contain a string "server".
When I type "server" in the search bar of Windows Explorer, I immediately get the list of the files that contain string "server" (it should be noted, that the search finds "server" string only if this string is between XML tags <> )
Now, suppose I have another directory which contains several dozen of files with .cfg extension.
I know that some of these .cfg files contain a string "server". To be exact, they contain string which looks like this:
server[0]=10.1.10.1:12758
If I type "server" in Windows Explorer search function while being in the directory which contains .cfg files, no items are found at all.
I just want to double-check if Windows Explorer search function is able to retrieve values that are stored between XML tags, or is there some workaround to find certain values contained within certain files via the usual Windows Explorer function?
I am about to write a PowerShell script to retrieve certain values stored within files, but first I want to make sure whether some built-in solution does not already exist.
To clarify, I am searching for values stored within the files, not within the filenames.
thank you
All replies (3)
Tuesday, January 21, 2020 11:38 AM
Hi
Yes, there is a way to do this in Windows Explorer. If you are in a folder and press Ctrl+F you get a searce tab on top. There you can choose Advanced options and File contents:
When you select this, the search will also search within files. In this example file2.txt contains the text teststring:
Tuesday, January 21, 2020 2:35 PM
Hi Eirik,
Thanks for the tip. It turns out that "File contents" option is already selected on my machine, but still I get no results when I search for a string "server" within .cfg files.
I also performed a simple test - copied the string server[0]=10.1.10.1:12758 from a .cfg file and pasted it into a new .txt file. Then I searched for a string "server" and this time Windows Explorer showed me that it found "server" occurrence in the .txt file, but not in .cfg.
Therefore I conclude that the Advanced search in Windows Explorer works for .txt and .xml files
Tuesday, January 21, 2020 8:05 PM
I get no results when I search for a string "server" within .cfg files.
Add .cfg to the indexing file types.
Personally I'd recommend that you use Agent Ransack instead.