Powershell - Erase content of File



Cmdlet

Clear-Content cmdlet can be used to erase content of a txt file.

In this example, we're erasing content of test.txt.

Clear-Content D:\temp\test\test.txt

Now, if we read content of test.txt.

Get-Content D:\temp\test\test.txt
powershell_files_io.htm
Advertisements