News for hackers. Stuff that matters.
Re:Excel: Error when CSV file starts with “I” and “D” by 13of40 on Wednesday July 06, 2016 @04:35AM (#12041894)
For historical reasons, the MZ is interpreted as the header of a 16-bit executable. When you run something under CMD (hopefully I'm getting this right, it's been a few years) it first runs it using the CreateProcess API, which just tries to run the file as an executable, regardless of extension, then it falls back to ShellExecute if it doesn't have an MZ header, which dispatches based on extension.

Basically you get a dialog saying the text file isn't a compatible executable. If you change the MZ to anything else, it opens in notepad.

Re:Excel: Error when CSV file starts with “I” and “D” by Piskvorrr on Wednesday July 06, 2016 @06:59AM (#12042287)
Well, you are trying to execute the text file (with ShellExecute as a fallback). Windows does what you ordered it to.
Re:Excel: Error when CSV file starts with “I” and “D” by tehmaco on Wednesday July 06, 2016 @06:29AM (#12042201)
Windows 7 64 bit here - it just has the error message box, and the same text in the cmd window, it doesn't open the file though :)

"This version of foo.txt is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher."

Re:Excel: Error when CSV file starts with “I” and “D” by JonathonW on Wednesday July 06, 2016 @12:46PM (#12044283)
That's because it's treating it as a 16-bit DOS executable (since it has the 'MZ' magic number but not the rest of the PE header that tells Windows that it's 32 or 64-bit). 64-bit Windows can't run 16-bit executables at all.

32-bit Windows should fail a little later in the execution process; it can run 16-bit software, but your text file is missing the rest of the MZ-format header.