Skip to content

Instantly share code, notes, and snippets.

@kinoh
Created November 3, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinoh/2be714ff562fca56988a1372d7fc7195 to your computer and use it in GitHub Desktop.
Save kinoh/2be714ff562fca56988a1372d7fc7195 to your computer and use it in GitHub Desktop.
Give BOM to all the source files.
foreach($i in Get-ChildItem -Recurse) {
if ($i.PSIsContainer) {
continue
}
# You might need some more pattern
if ($i.FullName -like "*.cc" -or $i.FullName -like "*.h") {
echo $i.FullName
$tmp = $i.FullName + ".tmp"
get-content -Encoding UTF8 $i.FullName | set-content -Encoding UTF8 $tmp
remove-item $i.FullName
move-item $tmp $i.FullName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment