POWERSHELL HANDLE FILE CONTENTS

To add contents to a file we can use the Add-Content cmdlet.

1
Add-Content -Path C:\path_to_destination_file "Content to be added"

To get a file contents we can use the Get-Content cmdlet.

1
Get-Content C:\file_to_source | Add-Content -Path C:\path_to_destination_file

This is similar to use cat and redirection >> in the Unix world.

1
cat /file_to_source >> /path_to_destination_file
1
Add-Content -Path C:\path_to_destination_file "Content to be added"; Get-Content C:\file_to_source | Add-Content -Path C:\path_to_destination_file

Related Content