Out-File -Encoding problems using PowerShell replace command

485 Views Asked by At

I am modifying dummy file a.gradle which in on my desktop and then trying to replace it with actual Github project's gradle file under git directory on my local machine using below PowerShell command

Get-Content "a.gradle" -replace 'foo', 'bar'| Out-File "b.gradle"

But When I tried to run gradlw test command it is throwing an error:

unexpected char: 0x0 @ line 1, column 4. ??a p p l y p l u g i n : ' j a v a '

I tried appending "encoding "UTF8" after Out-File command but it is not working.

0

There are 0 best solutions below