Windows 10: Windows Syntax & Search

  1.    11 Feb 2018 #1

    Windows Syntax & Search

    I want to search for strings that occur within the contents of text files.
    I am definitely missing something with respect to Windows' search syntax or Windows in general...sorry!
    To avoid the complexity of my specific issue, I created the following test scenario.
    1) I created a file called test.txt on my Desktop
    2) I entered the string "abc123abc" in test.txt
    3) I double checked that test.txt is IS
    ....a) I deleted and rebuilt my index database
    ....b) I double checked that test.txt is indexed IS again
    4) I attempted to search, unsuccessfully, for test.txt
    ....a) My search strings are
    ........i) not "test"
    ........ii) "abc"
    ........iii) "123"
    ........iv) "*abc*"
    ........v) "*123*" "?abc?"
    ........vii) "?123?"
    I really do not understand what I am missing.
    Please help!
    PS: Those dots everywhere are to counter this forum's automatic white space edit.
    Last edited by razam; 11 Feb 2018 at 13:18. Reason: Automatic White Space Edit F'ed My Post
      My ComputerSystem Spec

  2. Kari's Avatar
    Posts : 15,054
    Windows 10 Pro
       11 Feb 2018 #2

    Search for a file containing a specific string in file contents:


    Search for a file with two specific strings in file contents:

    contents:string1 AND contents:string2

    Search for a file with at least one of three specific strings in file contents:

    contents:string1 OR contents:string2 OR contents:string3

    Search for a file with one of two specific strings in file contents, excluding files which also have a spefic string:

    contents:string1 OR contents:string2 NOT contents:string3

    Note that logical operators AND, OR, NOT must be given in all uppercase.

      My ComputerSystem Spec

  3.    11 Feb 2018 #3

    Thank you for your reply Kari.
    Please help me understand another detail.
    When I enter into the search text box, the following strings,
    ........I find test.txt
    ........I do not find test.txt
    ........I find test.txt
    ........I do not find test.txt
    ........I find test.txt
    ........I do not find test.txt
    Why do I not find test.txt when searching for "contents:123", "contents:*123*", and "contents:?123?" while I do find test.txt when searching for "contents:abc", "contents:*abc*", and "contents:?abc?" ?
    Last edited by razam; 11 Feb 2018 at 14:05. Reason: Why does this forum mess with my white space?
      My ComputerSystem Spec

  4. Kari's Avatar
    Posts : 15,054
    Windows 10 Pro
       11 Feb 2018 #4

    Add double tilde (~~) to search a partial string within a string:


    Without two tildes, the partial string you are searching for must be at the beginning of the string. Double tilde tells it can be located within a longer string.

      My ComputerSystem Spec

  5.    11 Feb 2018 #5

    With respect, I still do not understand because my searches for both




    fail to find test.txt.

    Is there documentation regarding Windows syntax that you can refer me too?

      My ComputerSystem Spec

  6. Kari's Avatar
    Posts : 15,054
    Windows 10 Pro
       11 Feb 2018 #6
      My ComputerSystem Spec

  7.    12 Feb 2018 #7

    Hi, it seems the difficulty is that you must specify text from the start of the string.

    The question is discussed here:
    File Explorer how to search content using wildcards

    Neither * nor ? are recognised as wild card characters in content search- * seems to be ignored.
    (They are valid for filename search though).

    What works (for me!)

    Note that
    *abc finds the file, which might suggest
    *3abc would, but it doesn't.

    What doesn’t work:

    Advanced Query Syntax gives a lot of information, but is old and not complete.
    Even 'How to Geek' only gives a simple example of text content search
    Learning Windows Search: Use Boolean, Dates, and Wildcards to Give Your Searches a Boost

    3rd party tools are just simpler.. even if they don't index content like this one:
    Click image for larger version. 

Name:	1.jpg 
Views:	1 
Size:	54.4 KB 
ID:	176759
    Here I started from 'Everywhere' (both disks), specified txt documents containing 123abc

    The result was fairly quick.
      My ComputerSystem Spec

  8.    12 Feb 2018 #8

    Thanks for your help. I decided to use Notepad++ and/or Grep for Windows.
      My ComputerSystem Spec


Related Threads
I really am stuck I have a search string of "kent local car hire" I want to echo that to the Microsoft-edge browser with that search string entered into the browser in google search. start micrsoft-edge: Google -private
Hi, can you please give me an advice about using PSEXEC on Windows 10? I would like to run/start program with GUI on remote computer, but its not working. I Can run program with PID, which i can see in task manager, but no GUI is showing on...
can someone show me a sample xcopy command to copy C:\Directory1 and C:\Directory2 to a destination directory H:\DestinationDirectory?
In Audit mode, if I run the %SystemRoot%\System32\Cmd.exe /c cleanmgr /sageset:65535 & cleanmgr /sagerun:65535 command from the Command Prompt, the "Disk Cleanup Settings" window is displayed. So, I select all the items and press Ok. Now, before...
VIM Syntax Highlighting in Windows Insider
I've been playing around with the new Bash just fine - all is well! When I set up my .vimrc, everything also worked well. I installed all my usual plugins, and my keymappings work fine. The only problem is with the colorscheme and syntax...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:10.
Find Us