中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 12:21
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » How to remove the trailing newline at the end of a DOS batch file?
Printable Version  4,605 / 0
Floor1 proof Posted 2021-03-29 15:56
高级用户 Posts 222 Credits 689
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 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023