PS
Powershell Tutorial Online

Powershell-with-filesystem-Add-Content

Using Add-Content cmdlet you can append data to a text/html file.

Example


     Add-Content c:\test\test.txt "Footer"
    

Copy and Try it


Or

Example


     Add-Content c:\test\index.html "Footer"
    

Copy and Try it


Or

Example


     Add-Content c:\test\index.html "`nFooter"
    

Copy and Try it

I observed in my carrer that most of the people struggle to play with special characters and escape sequence as it is differnet for each language like new line characters. So here are the special characters used in Windows PowerShell output

Example


        `0 -- Null
        `a -- Alert
        `b -- Backspace
        `n -- New line
        `r -- Carriage return
        `t -- Horizontal tab
        `' -- Single quote
        `" -- Double quote
    

Copy and Try it


Example

Example


     Add-Content c:\test\index.html "`nFooter"
    

Copy and Try it

you can find more details at Powershell language special characters


Powershell Tutorial is optimized for learning technology step by step. Examples might be simplified to improve reading and basic understanding. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Send your suggestions or feedback to [email protected]
Copyright © 2014 by Powershell Tutorial. All Rights Reserved.