Reputation: 1989
I have batch file whose job is to create a text file and write the content
REM CreateFile.bat
@echo off
echo %1> C:\temp\%1.txt
exit
Ex: If I call the CreateFile.bat DB12232131
this going to create a text file DB12232131.txt
with content DB12232131
But the text file created has a line feed
DB12232131
How can i remove the Line feed?
Thanks
Karthik
Upvotes: 0
Views: 1731
Reputation: 82410
As echo
always append a linefeed you can use a workaround.
<nul set /p ".=%1" > c:\temp\%1.txt
But set/p
have some limitations, like removing leading spaces and tabs and fail with leading equal signs, but I suppose it can be igrnored in your case.
Upvotes: 2