Page 1 of 1
strip eol character of echo command
Posted: 29 Aug 2012 05:11
by miltos
i want to redirect echo output to a file but without the eol char.
for example
echo salalalala > something.text
something.text contains
1 salalalala[CRLF]
2 [newline]
Is there any quick way to disable eol?
Re: disable eol character of echo command
Posted: 29 Aug 2012 05:27
by miltos
never mind; I found something that works for me
@echo off
echo | set /p =salala > something.text
Re: disable eol character of echo command
Posted: 29 Aug 2012 07:33
by Ed Dyreen
'
Here is another way of achieving what you want, it works because the input stream is closed by the redirecting to con.
Code: Select all
<nul set /p "=salala" > something.text
The reason you have to pipe CRLF to set is cause 'set /p' is meant to read input from device.
Code: Select all
>set /?
...
SET /P variabele=[promptString]
It expect termination of the input.