To bulk modify the encoding of files using PowerShell:
Microsoft Docs PowerShell 6 ForEach-Object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Path C:\some-dir\* -Include *.ext -Recurse | ForEach-Object { | |
$content = Get-Content $_.FullName | |
$content | Out-File -Encoding UTF8NoBOM $_.FullName | |
#write-host "Encoding changed:" $_.FullName | |
} |
Requirements
PowerShell 6.2.3References
Microsoft Docs PowerShell 6 Get-ChildItemMicrosoft Docs PowerShell 6 ForEach-Object
Comments
Post a Comment