Created
February 20, 2012 12:14
-
-
Save breezhang/1868969 to your computer and use it in GitHub Desktop.
from twitters :)
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
function Get-HexDump($path,$width=10, $bytes=-1) | |
{ | |
$OFS="" | |
Get-Content -Encoding byte $path -ReadCount $width ` | |
-totalcount $bytes | Foreach-Object { | |
$byte = $_ | |
$hex = $byte | Foreach-Object { | |
" " + ("{0:x}" -f $_).PadLeft(2,"0")} | |
$char = $byte | Foreach-Object { | |
if ([char]::IsLetterOrDigit($_)) | |
{ [char] $_ } else { "." }} | |
"$hex $char" | |
} | |
} | |
#function Get-xxx { | |
# Write-Host "Get-xxxx:" | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment