The code at the bottom finds all files containing someString on the desktop and writes the file names to a text file.

findstr/m someString %userprofile%\Desktop\*.txt > result.txt 

But if the files in the title contain Russian text, then the result will be a set of random characters instead.

How to fix it?

chcp 1251 changes nothing as a result

    1 answer 1

    Here is the solution:

     SetLocal EnableDelayedExpansion For /F "Delims=" %%I In ('findstr/m someString %userprofile%\Desktop\*.txt') Do Set V=%%~I chcp 1251 Echo !V! > result.txt