How can I redirect the output from a command to the end of a file?

A. In another FAQ (How can I redirect the output from a command to a file?), we saw how to redirect a command's output to a file using a single right angle bracket (>). However this method replaces the file's existing content with the command's output.

To append the command's output to a file, you use double right angle brackets (>>). For example,

C:\> dir d:\temp\*.* >> dirlist.txt

results in the output being appended to file dirlist.txt.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish