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