When I read a file into a variable
$file = Get-Content myfile.utf8
and then write this same content into a new file
Set-Content -Encoding utf8 mynewfile.txt $file
Powershell automatically adds a return and linefeed to the end of the file.
How can I get the content of a file and write it back without Powershell adding anything?
Here is a workaround from this site.
Use