PowerTip: Read .exe Magic Number with PowerShell
Summary: Learn how to use Windows PowerShell to see an .exe magic number.
How can I use Windows PowerShell to see the "magic number" associated with an executable file in Windows?
The term magic number refers to the bytes that occur at the beginning of every file and identify the format of file.
Use this command to read a Windows executable file header with Windows PowerShell:
[char](gc $env:windir\notepad.exe -Encoding Byte -ReadCount 1 -TotalCount 2)