strip eol character of echo command

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miltos
Posts: 6
Joined: 28 Mar 2012 04:38

strip eol character of echo command

#1 Post by miltos » 29 Aug 2012 05:11

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?
Last edited by miltos on 29 Aug 2012 06:47, edited 1 time in total.

miltos
Posts: 6
Joined: 28 Mar 2012 04:38

Re: disable eol character of echo command

#2 Post by miltos » 29 Aug 2012 05:27

never mind; I found something that works for me

@echo off
echo | set /p =salala > something.text

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: disable eol character of echo command

#3 Post by Ed Dyreen » 29 Aug 2012 07:33

'
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.

Post Reply