I
I
Ivan Melnikov2019-06-10 11:34:43
cmd/bat
Ivan Melnikov, 2019-06-10 11:34:43

Why does the findstr command return nothing in cmd?

Writing

C:\Users\Melnikov-iv\Desktop>findstr /C:"SID" temp.txt >out.txt 2>error.txt
,
but the command returns nothing (files out.txt and error.txt are empty).
The temp.txt file exists, is located in \Desktop, and one of the lines contains the substring "SID".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2019-06-13
@immelnikoff

Before findstrexecute:

rem Перекодировка файла в UTF-16 c BOM(!) в текущую кодировку консольного окна
cmd /a /c type temp.txt >temp2.txt
move /y temp2.txt temp.txt

See e.g. CMD/BAT: Recoding Text Files for an understanding .
However, it is possible to recode on the go:
or
or
In the end, you can findstruse instead find:
find "SID" <temp.txt >out.txt 2>error.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question