search in files with strange characters


cokedude

New member
Local time
11:08 PM
Posts
12
OS
10 and 11
Normally windows can search in files. Some programs add a `~` to the beginning of backup files. I would like to search in these files. Is this possible? Windows seems to have issues searching in these files.
 

My Computer

System One

  • OS
    10 and 11
    Computer type
    Laptop
Tilde (~) is a reserved character in the query language. You need to escape it, something like:
Code:
file:~"~*"

1733890273358.webp
 

My Computer

System One

  • OS
    Windows 7
Try this batch script code it searches string in *.txt text files on current directory.

Code:
@echo off
setlocal enabledelayedexpansion

set /p "searchString=YOUR_STRING_HERE"


for %%F in (*.txt) do (
    findstr /c:"%searchString%" "%%F" >nul && echo Found: %%F
)


pause
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Pavilion
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    Erica6
    Memory
    Micron Technology DDR4-3200 16GB
    Graphics Card(s)
    NVIDIA GeForce RTX 3060
    Sound Card
    Realtek ALC671
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Screen Resolution
    3840 x 2160
    Hard Drives
    SAMSUNG MZVLQ1T0HALB-000H1
Try this batch script code it searches string in *.txt text files on current directory.

Code:
@echo off
setlocal enabledelayedexpansion

set /p "searchString=YOUR_STRING_HERE"


for %%F in (*.txt) do (
    findstr /c:"%searchString%" "%%F" >nul && echo Found: %%F
)


pause

So in this case I just create a batch file then put the batch file in the directory I want to search? Is there a way to update this to specify the folder I want?
 

My Computer

System One

  • OS
    10 and 11
    Computer type
    Laptop
Like this 248294 file:~"~*"? Wanna search for the number 248294.
Strange...

1. You can separately search for text string 248294 in files.
2. Or you can separately search for filenames matching "~".
3. But you can't do both at the same time.

I found a PowerShell scripting example which uses the Windows Search API, to see if it's a limitation on the Explorer UI. And it's not, the PS script has the same problem. For some reason, you're not allowed to do both.

So I modified the script to just find "~" files that are indexed already, and then manually search those known files for instances of a search string. You don't need to specify a path, it's querying the Search Index for whatever has been indexed.

Code:
C:\Users\GARLIN\Downloads>WinSearch.bat 248

C:\Users\GARLIN\Documents\~249cef99eee94q.tmp
=============================================
This is a line with 248294 in it.

C:\Users\GARLIN\Documents\~NEW
==============================
248 248 248
 

Attachments

My Computer

System One

  • OS
    Windows 7
Look outside the Window ... go freeware
- Everything
- Ultrasearch
- Agent Ransack
 

My Computers

System One System Two

  • OS
    Windows 11 2xH2 (latest update ... forever anal)
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Slim S01
    CPU
    Intel i5-12400
    Memory
    8GB
    Graphics Card(s)
    NVIDIA GeForce GT730
    Sound Card
    OOBE
    Monitor(s) Displays
    Acer 32"
    Screen Resolution
    1920x1080
    Hard Drives
    512GB KIOXIA NVMe
    1TB SATA SSD
    PSU
    OOBE
    Case
    OOBE
    Cooling
    OOBE
    Keyboard
    BT
    Mouse
    BT
    Browser
    Brave FFox Chrome Opera
    Antivirus
    KIS
  • Operating System
    Windows 11 Pro 2xH2 (latest update ... 4ever anal)
    Computer type
    Laptop
    Manufacturer/Model
    HP Pavillion 15
    CPU
    i7-1165G7 @ 2.80GHz
    Graphics card(s)
    Intel Iris Xe Graphics
    Hard Drives
    Samsung NVMe 512GB
    + numerous/multiple SSD Type C USB enclosures
    Internet Speed
    NBN FTTN 50
    Browser
    Brave
    Antivirus
    KIS
Back
Top Bottom