tags:

views:

305

answers:

2

How do I delete the last line of a text file using the echo command in windows?

+3  A: 

Echo only has 2 uses:

ECHO [ON | OFF]
ECHO [message]

You can overwrite a file completely using a redirect

ECHO Testing > a.txt

Or you can append to a file using an append redirect

ECHO Testing >> a.txt

Or you can write a new line

ECHO.

But you can't use it to remove the last line

Brian R. Bondy
A: 

Have a look for a 'tail' command/equivalent (plenty on google depending on OS version).

then

copy oldfile tempfile

tail -1 > oldfile

Regards Michael.

Michael