Commands / Files

Add-Content

Append text to a file

beginner Files Aliases ac

Add-Content
 Add-Content -Path .\notes.txt -Value 'Another line'
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Add-Content

Appends without deleting existing lines. Creates the file if it does not exist.

Try this

Add-Content -Path .\notes.txt -Value (Get-Date)

Coming from another shell

ShellWhat you might type
bash / zshecho 'Another line' >> notes.txt
cmd.exeecho Another line>> notes.txt

More in From bash and From cmd.

Related commands