Solved findstr : Why not found?


anyname

Banned
Local time
3:18 PM
Posts
103
OS
Win11 Pro 23H2
findstr.webp
 

My Computer My Computer

At a glance

Win11 Pro 23H2
OS
Win11 Pro 23H2
Is it possible that the second file might be encoded using UTF-16, in which case findstr won't work with it? Instead, you could try "find" which appears to detect the presence/absence of "Mode=", or findtsr using regex also appears to work on UTF-16 files (with awkward string input & output!) .

Code:
findstr /R /C:"M.o.d.e.=" desktop.ini
find /C "Mode=" desktop.ini

FINDSTR does not support UTF-16 files, but FIND does.
 
Last edited:

My Computer My Computer

At a glance

Win 11 25H2intel i7-870032GbIntel iGPU
OS
Win 11 25H2
Computer type
PC/Desktop
Manufacturer/Model
custom
CPU
intel i7-8700
Motherboard
Asus Z370 TUF Gaming
Memory
32Gb
Graphics Card(s)
Intel iGPU
Sound Card
Realtek
Hard Drives
Samsung
PSU
Corsair
Cooling
Fans
or type desktop.ini | findstr /c:"Mode="
 
Last edited:

My Computer My Computer

At a glance

Windows 11 Pro 25H212th Gen Core i7-1260P64 GB Micron PC4-25600Intel Iris Xe Graphics
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Intel NUC12WSHi7
CPU
12th Gen Core i7-1260P
Motherboard
NUC12WSBi7
Memory
64 GB Micron PC4-25600
Graphics Card(s)
Intel Iris Xe Graphics
Sound Card
on-board Realtek HD Audio
Monitor(s) Displays
Dell U3219Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung SSD 990 PRO 1TB
Crucial MX500 2 TB
Antivirus
Microsoft Defender
The mystery is solved.

I thank you both.

Apparently pseymour's solution (ignoring the typo) works because the output of command "type" is not UTF-16.

Command "find" works if you omit the /C. Its output adds line containing file name (undesirable in my use).
 
Last edited:

My Computer My Computer

At a glance

Win11 Pro 23H2
OS
Win11 Pro 23H2
Yeah I was actually looking for a different string to test it and changed it to More/Mode when I pasted it here. :)
 

My Computer My Computer

At a glance

Windows 11 Pro 25H212th Gen Core i7-1260P64 GB Micron PC4-25600Intel Iris Xe Graphics
OS
Windows 11 Pro 25H2
Computer type
PC/Desktop
Manufacturer/Model
Intel NUC12WSHi7
CPU
12th Gen Core i7-1260P
Motherboard
NUC12WSBi7
Memory
64 GB Micron PC4-25600
Graphics Card(s)
Intel Iris Xe Graphics
Sound Card
on-board Realtek HD Audio
Monitor(s) Displays
Dell U3219Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung SSD 990 PRO 1TB
Crucial MX500 2 TB
Antivirus
Microsoft Defender

Latest Support Threads

Back
Top Bottom