Discussion Locked

add a line of text to the end of files

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

can anyone help,

i need to alter a number of batch files to put another command at the
end of them, I think I can use a for loop to open them but how do I
add a line of text at the end of the file?

any help would be very much appriciated

6 replies

by mm212

The command would be something like this:
echo "New Command" >> "BatchFile.bat"

So if you wanted to add the "dir" command to the end of a file named batch.bat, you would include:

echo "dir" >> batch.bat

by mm212

Just a "By-The-Way":

A single right arrow > will overwrite everything in a file.

A double right arrow >> will append to the end of a file.

This discussion is closed to new replies.