[ACCEPTED]-powershell to get the first x MB of a file-powershell
Accepted answer
Get-Content foo.exe -TotalCount 1MB -Encoding byte
If you happen to be using PowerShell Community Extensions then do this:
Format-Hex foo.exe -count 1MB
Note: If 2 you are using PowerShell V2 be sure to grab 1 the 1.2 beta of PSCX.
Independent of PowerShell, I'd just use 3 the head
command. (It's a standard Unix command, but 2 it's available for Windows.) The -c
option lets you specify the number 1 of bytes you want.
head -c 1024 foo.exe
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.