You can do a lot of things with Add-Content.
These are all the parameters you can use with Add-Content.
Add-Content
[-Value]
The following example demonstrates on of them using the -Path parameter.
Now create two (or more) empty files in an allowed folder:
I created two text files (empty) and saved them to a folder:
C:\Users\Jayaram\Documents\Jay_1.txt
C:\Users\Jayaram\Documents\Jay_2.txt
Now using Add-Content, I will add current date to the end of these files. These being empty, the dates will added to the top of the files.
Now launch the Windows PowerShell ISE and run this code:
These are all the parameters you can use with Add-Content.
Add-Content
[-Value]
The following example demonstrates on of them using the -Path parameter.
Now create two (or more) empty files in an allowed folder:
I created two text files (empty) and saved them to a folder:
C:\Users\Jayaram\Documents\Jay_1.txt
C:\Users\Jayaram\Documents\Jay_2.txt
Now using Add-Content, I will add current date to the end of these files. These being empty, the dates will added to the top of the files.
Now launch the Windows PowerShell ISE and run this code:
Now go check the files and you should see the dates added.
No comments:
Post a Comment