Assining .bat and .com files with the desktop

Damjan Jovanovic damjan.jov at
Mon Aug 15 00:49:32 CDT 2011

On Mon, Aug 15, 2011 at 1:02 AM, Scott Ritchie <scott at> wrote:
> On 08/11/2011 09:18 AM, Vincent Povirk wrote:
>> I'm not sure DOSBox is able to competently open some random executable
>> file. One would have to make a config file that sets up a drive
>> mapping, runs the file, and quits. If Wine can do these things (and
>> maybe also properly handle cases where the COM executable expects to
>> be run on a windows machine or, say, a dos machine with win3.1
>> installed), it seems like a fine choice to me.
>> There's a non-zero chance that wine start /unix will actually start
>> cmd and make a terminal for BAT files. It makes one for console
>> executables. If it doesn't, there's a possibility that start.exe will
>> do that on Windows, in which case that is a Wine bug that we should
>> fix. You should test that before making a new thing.
>> There was some talk on #mono (or #monodev) to the effect that the
>> arbitration mechanism for different kinds of files is called mime
>> types, and a DOS exe, x86/x64 PE exe, and CLR exe are all different
>> and should have different mime types.
> To extend this, the relevant project is's
> shared-mime-info and if it can't yet tell them apart that's simply a bug.
> Is there a super-easy way for shared-mime-info to tell these guys apart?
> Thanks,
> Scott Ritchie

Parsing the EXE headers requires pointer traversal (for example you
need to go to the offset specified in IMAGE_DOS_HEADER's e_lfanew
dword at offset 0x40 in the file to get to the extended header which
starts with "NE" in the case of a Win16 executable). While "file" can
do this and "man 5 magic" even has examples on how it is done for an
EXE file, the simple parsing done by shared-mime-info seems unable to
follow pointers.

Damjan Jovanovic

More information about the wine-devel mailing list