Created
July 18, 2015 14:54
-
-
Save kfstorm/0eed39dc632fb7e3bead to your computer and use it in GitHub Desktop.
Detect BOM in batch files
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
[byte[]] $WrongBytes = 0x00,0xEF,0xFE,0xFF | |
Get-ChildItem -Include *.bat,*.cmd -Recurse | ForEach-Object { | |
$content = Get-Content $_ -Encoding Byte | |
if ($WrongBytes.Contains($content[0])) | |
{ | |
echo $_.FullName | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment