When I issue this command: FINDSTR /I /N "<sdk:extra>" addon.xml output is:

973:    <sdk:extra>
995:    <sdk:extra>
1017:    <sdk:extra>
1036:    <sdk:extra>
1057:    <sdk:extra>
1078:    <sdk:extra>
1098:    <sdk:extra>
1118:    <sdk:extra>
1140:    <sdk:extra>
1161:    <sdk:extra>
1182:    <sdk:extra>
1203:    <sdk:extra>
1223:    <sdk:extra>
1244:    <sdk:extra>

But when I redirect it to file with this command:

FINDSTR /I /N "<sdk:extra>" addon.xml > find_s.txt

find_s.txt have UNIX line ending (Newline or EOL if you like it more).

Anybody know why? I need a DOS line ending, or it breaks the whole batch.

How do you convert file from UNIX to DOS line endings in Windows batch?

(without using external binary or powershell) (.js and .vbs are fine)


TTT is right that your file should be in unix format. If you don't mind the order, you can pipe the output to sort first. Otherwise need another utility.

FINDSTR /I /N "<sdk:extra>" addon.xml | sort > find_s.txt
  • This look like perfect solution, no need to another commands or temp files. – Snoop05 Dec 4 '14 at 17:36

If you are in a bat file, you can

del find_s_dos.txt
for /f "delims=" %%i in (find_s.txt) do @echo %%i>>find_s_dos.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.