China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 11:12
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to remove the trailing newline at the end of a DOS batch file? View 4,447 Replies 0
Original Poster Posted 2021-03-29 15:56 ·  中国 天津 联通
高级用户
★★
Credits 687
Posts 222
Joined 2005-08-21 22:37
20-year member
UID 41842
Status Offline
DOS 7.1

When a batch processing bat file is executed, there is always an extra command line at the end:
C:\> (This line is redundant, resulting from the 0D0A at the end of the bat file)
C:\>

The same situation occurs with AUTOEXEC.BAT. As long as it is edited with q, qe, or edit, the last lines after execution are always: (two lines)
C:\>
C:\>

Although it doesn't affect much, it always looks unpleasant.
Although using @ECHO OFF can turn it off, I am used to ECHO ON
I once used Pctools to edit AUTOEXEC.BAT in binary, replacing 0D0A with 0000, but this process is more troublesome. And every time after editing with qe, I have to edit with Pctools.

1. Is there a simple binary editing software under DOS? Simply changing 0D0A to 0000, will the file structure table not be damaged?
2. Or is there a DOS text editing tool (q, qe, edit don't work) that allows the end-of-file character 1A to be directly after the text characters?


[ Last edited by proof on 2021-3-29 at 16:26 ]
Forum Jump: