How to read a file in UTF-8 and remove a BOM in batch script?
Posted: 2021-Oct-04, 11:25 am
Hi
How to read a file in UTF-8 and remove a BOM in batch script?
How to read a file in UTF-8 and remove a BOM in batch script?
Command line / Scripting forums
https://ss64.org/
Code: Select all
$files=get-childitem -Path . -Include @("*.h","*.cpp") -Recurse
foreach ($f in $files){
(Get-Content $f.PSPath) |
Foreach-Object {$_ -replace "\xEF\xBB\xBF", ""} |
Set-Content $f.PSPath
}