Skip to main content

Posts

Showing posts with the label PowerShell

Change File Encoding with Powershell

To bulk modify the encoding of files using PowerShell: File: alter-encoding.ps ----------------------- 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.3   References Microsoft Docs PowerShell 6 Get-ChildItem Microsoft Docs PowerShell 6 ForEach-Object