Solved Echo to file also creates a NewLine, how to remove?

December 13, 2011 at 01:19:22
Specs: Windows Vista, 7Gbyte Ram / Core 2 Duo 3Ghz
Hi guys,

I've created a file parser which reads all passwords contained in 1 Log file and outputs each individual password to 1 file.

Now my problem is that along with the password outputed to each file the echo command also decides to add a NEWLINE to each file which completely ruins everything for me because afterwards i want to parse that password through an MD5 encrypter and the MD5 Encyrpter also reads the NEWLINE character and creates a different hash from what i need.

Very simply this is my code:

setlocal EnableDelayedExpansion
for /F "tokens=3 delims=|" %%a in ('type C:\Bulker\auths.txt') do (
set str=%%a
set /A FF+=1

Is there a way to either remove that Carriage return/newline or to output my password with another command to the file?

See More: Echo to file also creates a NewLine, how to remove?

Report •

December 14, 2011 at 13:32:17
✔ Best Answer
I'm not 100% sure, but it might be that pipe delimiter. You might need to escape it.

Report •

December 14, 2011 at 23:49:49
You can use "set /p" to avoid the new lines, but there is one catch the first character on the line can't be "=".


for /F "usebackq tokens=3 delims=|" %%a in ("C:\Bulker\auths.txt") do (
    <nul set /p =%%a
    set /A FF+=1
) >>c:\Bulker\temppass.txt

Report •
Related Solutions

Ask Question