FINDSTR and Unicode strings
Recently I had another look at my old post on finding unused resources in a .NET project, and realized that it would not work if any of the resource strings contain Unicode characters. The culprit turns out to be the FINDSTR command, which doesn’t support Unicode text files. To solve the problem, I replace FINDSTR with FIND.EXE (which supports Unicode). However, all is lost when my usage of FOR to tokenize the input files stops working with Unicode input. I also tried a few suggestions here and here to no avail.
My simple conclusion is that, batch script was not designed with Unicode in mind. Perhaps Windows Powershell can probably do a better job…
3 thoughts on “FINDSTR and Unicode strings”
Or just "type unicode.txt | findstr /i stringtobesearched"
I’m not a big fan of powershell … but it does do this well, especially for scanning the files in a directory tree…
powershell -Command “Get-ChildItem c:\ -Exclude *.exe,*.dll,*.cab,*.msi,*.zip -File -Recurse -EA SilentlyContinue | Select-String -Pattern ‘findable text'”