Sunday 24 April 2016

ADD-Content: Powershell command to add content to text file.

ADD-Content: Powershell command to add content to text file.

  • There are times when you want to ADD a content to text file after taking some actions in powershell
  • ADD-Content is the Command to use to add.
ADD-CONTENT C:\TEMP\test.txt "This is the Begning"

  • One more scenario is that you have list of text files and want to add a common thing to all then you can use the WildCards like below
$NTime=Get-Date
ADD-CONTENT C:\Temp\*.txt $Ntime

  • This will add the current date and time to all the text files in temp folder.

No comments:

Post a Comment