I am new to powershell. how do you over write file in powershell? write now below code is appending. I want to completely over write file with below new info.
$someinfo | Add-Content $FileName
I am new to powershell. how do you over write file in powershell? write now below code is appending. I want to completely over write file with below new info.
$someinfo | Add-Content $FileName
Use Set-Content
instead of Add-Content
.
Difference between Set-Content
and Add-Content
:
Add-Content
=> Append
Set-Content
=> replace content
You can do an Out-File
as well
'Some content' | Out-File -FilePath c:\windows\temp\file.log