I have a exe and when i run the exe I can see under the Platform column in Task Manager that it is 64 bit. Is there a way I can determine this without having to run the app ? I have looked at Powershell and seen this , but it comes up as 32 which is wrong ?
$FilePath = "C:\Program Files\UsersApp\userdetailsCfg.exe"
[int32]$MACHINE_OFFSET = 4
[int32]$PE_POINTER_OFFSET = 60
[byte[]]$data = New-Object -TypeName System.Byte[] -ArgumentList 4096
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList ($FilePath, 'Open', 'Read')
$stream.Read($data, 0, 4096) | Out-Null
[int32]$PE_HEADER_ADDR = [System.BitConverter]::ToInt32($data, $PE_POINTER_OFFSET)
[int32]$machineUint = [System.BitConverter]::ToUInt16($data, $PE_HEADER_ADDR + $MACHINE_OFFSET)
$stream.Close()
$result = "" | select FilePath, FileType, Is64Bit
$result.FilePath = $FilePath
$result.Is64Bit = $false
switch ($machineUint)
{
0 { $result.FileType = 'Native' }
0x014c { $result.FileType = 'x86' }
0x0200 { $result.FileType = 'Itanium' }
0x8664 { $result.FileType = 'x64'; $result.is64Bit = $true; }
}
$result