You can use the PowerShell add-content cmdlet to append data to a text file.

Powershell add-content example

Step 1. Open PowerShell with elevated privileges

Step 2. Execute the following command, (change the file path)

Add-Content c:\scripts\test.txt "The End"

By default, data is appended after the last character. If you want to append the data on a new line in the text document, use 'n. are some other special characters that can be used with add-content cmdlet.

Here are some other special characters that can be used with the add-content cmdlet.

  • `0 -- Null
  • `a -- Alert
  • `b -- Backspace
  • `n -- New line
  • `r -- Carriage return
  • `t -- Horizontal tab
  • `' -- Single quote
  • `" -- Double quote
How to Append Data to a Text File Using PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *

*