- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Append content to File
Cmdlet
Add-Content cmdlet can be used to append content of a any file.
In this example, we're adding content of test.txt.
Step 1
In this example, we're set content in a new txt file named test.txt
Type the following command in PowerShell ISE Console
Set-Content D:\temp\test\test.txt 'Hello'
Step 2
In this example, we're appending content to test.html.
Type the following command in PowerShell ISE Console
Add-Content D:\temp\test\test.txt 'World!'
Step 3
In this example, we're reading content of test.html.
Get-Content D:\temp\test\test.txt
Output
You can see following output in PowerShell console.
Hello World!
powershell_files_io.htm
Advertisements
To Continue Learning Please Login
Login with Google