PowerShell – Delete Empty Lines in Text File Posted onDecember 20, 2021May 17, 2022AuthorMrNetTek $Path = "C:\PowerShell\test.txt" (Get-Content $Path) | Where-Object {$_.trim() -ne "" } | Set-Content $Path