Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: How can I check (and run) if an *.exe is a DOS or a Windows program?

267 views
Skip to first unread message

Jude DaShiell

unread,
Jan 7, 2023, 7:00:05 AM1/7/23
to
Inspect the files with strings and pipe the output to less.



Jude <jdashiel at panix dot com> "There are four boxes to be used in
defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)

.

Timothy M Butterworth

unread,
Jan 7, 2023, 7:20:08 AM1/7/23
to

All .exe files are windows, linux does not use .exe! You can run Windows applications on Linux using: WINE, CrossOver Office or Steam Proton. I recommend CrossOver Office, I use it to play windows games on Linux. 

--
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀

The Wanderer

unread,
Jan 7, 2023, 7:52:59 AM1/7/23
to
On 2023-01-07 at 07:13, Timothy M Butterworth wrote:

> All .exe files are windows, linux does not use .exe!

While the latter statement is (largely) correct, the former is not. Some
.exe files are DOS programs, not Windows programs.

The question being asked is how to tell which type a given EXE is, and
assuming it turns out to be a DOS program, how to run it.

--
The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw

signature.asc

Joe

unread,
Jan 7, 2023, 8:50:05 AM1/7/23
to
On Sat, 7 Jan 2023 11:33:44 +0000
Ottavio Caruso <ottavio2006...@yahoo.com> wrote:

> I have a few DOS/Windows abandonware that I'd like to check but I
> only want the DOS ones, because Wine on my installation is a total
> pain.
>
> For example:
>
> $ file test2/sm416.exe
> test2/sm416.exe: Zip archive data, made by v2.0, extract using at
> least v2.0, last modified Sat Mar 15 12:34:37 1986, uncompressed size
> 221709, method=deflate, R

The first (barely) usable Windows was 3.0, 1990, though I've never seen
anything earlier than 3.1/3.11 in the wild. No doubt that this one is
DOS.
>
> It doesn't really say much about this executable. However, if I
> uncompress it:
>
> $ ls test2/sm/
> ADVANCE.DOC JOBS.SM RIGS.SM SMLRN.HLP SMREVU.HLP
> ANTENNAS.SM NAMES.SM RUNS.SM SMMAIN.HLP SMSESS.HLP
> CITIES.SM ORDER.SM SCRIPT.SM SMMEAS.HLP SMSTATS.HLP
> CLASSES.SM 'Q&A.SM' SESSION.SM SMMORSE.HLP SMTKEY.HLP
> EXAMQ.SM QSO1.SM SMBLD.HLP SMONLINE.HLP STATES.SM
> FEEDBACK.FRM QSO2.SM SMBYE.SMT SMOP.HLP STEPS.SM
> GROUPS.1 QUICK.DOC SMENH.HLP SMOPT.HLP
> WHATSNEW.416 GROUPS.2 QWORDS.SM SM.EXE SM.OVR
> GROUPS.SM README.1ST SMHOME.HLP SM.PIF
> HAMWORDS.SM REGWORDS.SM SM.ICO SMRADIO.HLP

DOS is limited to 8 characters before the '.', but of course Windows
can use such files also. Any more than 8 characters is definitely a
Windows file. You would generally expect Windows to use a few .dll
files in a group like this, though that isn't guaranteed. Help files
would normally be .chm files.
>
>
> $ file test2/sm/SM.EXE
> test2/sm/SM.EXE: MS-DOS executable, MZ for MS-DOS
>
> Which makes me think it's DOS but it could be a false positive. Then,
> how do I run it? Dosemu, Dosbox?
>
> Should that be run before or after uncompressing it?

Sorry, can't help there.

--
Joe

Jude DaShiell

unread,
Jan 7, 2023, 8:50:06 AM1/7/23
to
If I remember correctly, dos and windows .com and .exe programs all have
control-z as their first character. The file command may also help.

Hans

unread,
Jan 7, 2023, 9:00:06 AM1/7/23
to
As far as I know, you can look into the file with a hexeditor (maybe any other
editor should do it, too).

In the first line is written, which OS is required.

However, there could be anything written, but in most cases it is set
correctly. Please do not blame me, if I am wrong, but I blieve, this is known
as the "mime header". But I am not sure, how this one can be trusted in the
Windows world. In linux, the mime-header is the basics of recognition of the
kind of data, there are no endings needed or analyzed.

Best regards

Hans

Tixy

unread,
Jan 7, 2023, 10:00:05 AM1/7/23
to
On Sat, 2023-01-07 at 08:47 -0500, Jude DaShiell wrote:
> If I remember correctly, dos and windows .com and .exe programs all have
> control-z as their first character. The file command may also help.

If I remember correctly, COM files have no header, the first byte is
the first machine code instruction of the program, and it expects to be
loaded at address 100h in memory. (As CP/M did).

EXE files start with the ASICI chars 'M' and 'Z' (not sure on order).
And they'll be some header information too, I beleive. It'll all be in
a wikidepdia article I'm sure.

Yep, I remembered correctly...

https://en.wikipedia.org/wiki/COM_file
https://en.wikipedia.org/wiki/DOS_MZ_executable

And there seems to be a newer format used when Windows was
introduced...

https://en.wikipedia.org/wiki/New_Executable

--
Tixy

to...@tuxteam.de

unread,
Jan 7, 2023, 12:30:06 PM1/7/23
to
On Sat, Jan 07, 2023 at 08:47:09AM -0500, Jude DaShiell wrote:
> If I remember correctly, dos and windows .com and .exe programs all have
> control-z as their first character. The file command may also help.

No. Control-Z (aka 0x1a) was an EOF character under DOS. Files were
(sometimes...) terminated with that. Hilarity ensued when there was
stuff after that (DOS/Windows was very hilarious, for some value of
hilarious).

Cheers
--
t
signature.asc

to...@tuxteam.de

unread,
Jan 7, 2023, 12:30:06 PM1/7/23
to
On Sat, Jan 07, 2023 at 02:42:38PM +0000, Ottavio Caruso wrote:
> Am 07/01/2023 um 12:13 schrieb Timothy M Butterworth:
> > All .exe files are windows, linux does not use .exe! You can run Windows
> > applications on Linux using: WINE, CrossOver Office or Steam Proton. I
> > recommend CrossOver Office, I use it to play windows games on Linux.
> >
>
> So you're saying DOS didn't run .EXE files?

Of course it did. The file endings for DOS executables were .com and
.exe. But .exe is more of an umbrella for different formats, not all
of them natively viable in "pure" DOS (whatever this, again, may be).

As usual, Wikipedia [1] gives some good leads for those interested.

Cheers

[1] https://en.wikipedia.org/wiki/.exe
--
t
signature.asc

gene heskett

unread,
Jan 7, 2023, 3:30:05 PM1/7/23
to
You are being too kind, Tomas. That DOS was not the least bit
entertaining. :(> That was the best reason to skip it, I went from
amigados 3.9 to rh5.0, never regretted missing the DOS experience, I got
my fill of it as the CE at a tv station back in the day.

Take care, stay warm and well.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>

Georgi Naplatanov

unread,
Jan 7, 2023, 4:20:06 PM1/7/23
to
On 1/7/23 13:33, Ottavio Caruso wrote:
> I have a few DOS/Windows abandonware that I'd like to check but I only
> want the DOS ones, because Wine on my installation is a total pain.
>
> For example:
>
> $ file test2/sm416.exe
> test2/sm416.exe: Zip archive data, made by v2.0, extract using at least
> v2.0, last modified Sat Mar 15 12:34:37 1986, uncompressed size 221709,
> method=deflate, R
>
> It doesn't really say much about this executable. However, if I
> uncompress it:
>
> $ ls test2/sm/
>  ADVANCE.DOC    JOBS.SM       RIGS.SM      SMLRN.HLP      SMREVU.HLP
>  ANTENNAS.SM    NAMES.SM      RUNS.SM      SMMAIN.HLP     SMSESS.HLP
>  CITIES.SM      ORDER.SM      SCRIPT.SM    SMMEAS.HLP     SMSTATS.HLP
>  CLASSES.SM    'Q&A.SM'       SESSION.SM   SMMORSE.HLP    SMTKEY.HLP
>  EXAMQ.SM       QSO1.SM       SMBLD.HLP    SMONLINE.HLP   STATES.SM
>  FEEDBACK.FRM   QSO2.SM       SMBYE.SMT    SMOP.HLP       STEPS.SM
>  GROUPS.1       QUICK.DOC     SMENH.HLP    SMOPT.HLP      WHATSNEW.416
>  GROUPS.2       QWORDS.SM     SM.EXE       SM.OVR
>  GROUPS.SM      README.1ST    SMHOME.HLP   SM.PIF
>  HAMWORDS.SM    REGWORDS.SM   SM.ICO       SMRADIO.HLP
>
>
> $ file test2/sm/SM.EXE
> test2/sm/SM.EXE: MS-DOS executable, MZ for MS-DOS
>
> Which makes me think it's DOS but it could be a false positive. Then,
> how do I run it? Dosemu, Dosbox?
>

Hi Ottavio,

I think that "file" program has recognized the file properly. If this
was a Windows program it would contain installer like setup.exe file,
*.ini file, *.dll files so I think that this is a MS-DOS program.

You can try to run DOS programs with DosBox. If you have a virtual
machine with 32-bit Windows - this also will work.

Kind regards
Georgi

Miguel A. Vallejo

unread,
Jan 7, 2023, 6:50:06 PM1/7/23
to
If I remember correctly, all Windows EXE have an string saying:

This program cannot be run in DOS mode.

It is displayed when loaded under MS-DOS, so it should be easy to
identify an EXE for DOS from an EXE for Windows.

To run it, dosbox should work.

Greetings

Charlie Gibbs

unread,
Jan 8, 2023, 2:10:06 AM1/8/23
to
On Sat Jan 7 17:34:05 2023 <to...@tuxteam.de> wrote:

> On Sat, Jan 07, 2023 at 08:47:09AM -0500, Jude DaShiell wrote:
>
>> If I remember correctly, dos and windows .com and .exe programs
>> all have control-z as their first character. The file command
>> may also help.
>
> No. Control-Z (aka 0x1a) was an EOF character under DOS. Files were
> (sometimes...) terminated with that. Hilarity ensued when there was
> stuff after that (DOS/Windows was very hilarious, for some value of
> hilarious).

The use of control-Z to mark the end of a text file was inherited
from CP/M, whose directory entries store the size of a file as a
number of 128-byte sectors. The control-Z was a hack to enable
the actual end of the text to be found in the last sector - and
if the file size is a multiple of 128 it isn't even necessary.
MS-DOS and Windows store the size of a file to the byte, so
control-Z is not needed. However it lives on to this day,
still causing its share of headaches. In fact, an early version
of MS-DOS (3.0 or 3.1, IIRC) contained a bug: if you redirected
standard output to append to a file, e.g.

dir >>foo

and the file foo existed and contained text ending in hex 1A,
the appended text did not overwrite the hex 1A, resulting in
the appended text being dropped by any program that subsequently
read the file. Microsoft fixed that one pretty quickly.

A control-Z EOF marker is not required - and has never been required -
in any version of MS-DOS or Windows. Any program I write eradicates it.

But getting back to the original poster's message, try using a hex
editor or running the strings utility on the executable file, and
look at the first 128 bytes or so. If it's MS-DOS, you probably
won't see anything interesting. I've looked at various Windows
programs, compiled by different compilers, and found one of the
following messages in the first 128 bytes:

This program must be run under Microsoft Windows.
This program must be run under Win32
This program cannot be run in DOS mode.
This program requires Microsoft Windows.

--
/~\ Charlie Gibbs | They don't understand Microsoft
\ / <cgi...@kltpzyxm.invalid> | has stolen their car and parked
X I'm really at ac.dekanfrus | a taxi in their driveway.
/ \ if you read it the right way. | -- Mayayana

Roy J. Tellason, Sr.

unread,
Jan 8, 2023, 4:10:05 PM1/8/23
to
On Saturday 07 January 2023 03:27:31 pm gene heskett wrote:
> That DOS was not the least bit
> entertaining. :(> That was the best reason to skip it, I went from
> amigados 3.9 to rh5.0, never regretted missing the DOS experience, I got
> my fill of it as the CE at a tv station back in the day.
>

I remember getting a mailing (don't know how I ended up on that mailing list) where they wanted to sell me a development kit for windoze, which at that time hadn't even been released yet, or if it had it was a very buggy and clunky preliminary version.

They wanted me to pay something like $3000.00 for the privilege of developing software for their new platform.

I found this most entertaining, and laughed like hell before I got around to tossing that mailing in the trash.

--
Member of the toughest, meanest, deadliest, most unrelenting -- and
ablest -- form of life in this section of space,  a critter that can
be killed but can't be tamed.  --Robert A. Heinlein, "The Puppet Masters"
-
Information is more dangerous than cannon to a society ruled by lies. --James
M Dakin

Jeffrey Walton

unread,
Jan 8, 2023, 4:50:05 PM1/8/23
to
On Sat, Jan 7, 2023 at 6:43 PM Miguel A. Vallejo <ea4...@gmail.com> wrote:
>
> If I remember correctly, all Windows EXE have an string saying:
>
> This program cannot be run in DOS mode.

A couple of small nits...

They are called PE/PE+ programs. The string "This program cannot be
run in DOS mode" is called the MS-DOS Stub. It may or may not be
present. Most of the time it is present, but it is possible to build
an exe using the assembler without the message.

The first part of a PE program usually includes a DOS 2.0 header. The
DOS header allows the program to display the stub message under DOS
and exit.

Also see https://learn.microsoft.com/en-us/windows/win32/debug/pe-format.

Jeff

gene heskett

unread,
Jan 8, 2023, 7:40:05 PM1/8/23
to
On 1/8/23 16:04, Roy J. Tellason, Sr. wrote:
> On Saturday 07 January 2023 03:27:31 pm gene heskett wrote:
>> That DOS was not the least bit
>> entertaining. :(> That was the best reason to skip it, I went from
>> amigados 3.9 to rh5.0, never regretted missing the DOS experience, I got
>> my fill of it as the CE at a tv station back in the day.
>>
>
> I remember getting a mailing (don't know how I ended up on that mailing list) where they wanted to sell me a development kit for windoze, which at that time hadn't even been released yet, or if it had it was a very buggy and clunky preliminary version.
>
> They wanted me to pay something like $3000.00 for the privilege of developing software for their new platform.
>
> I found this most entertaining, and laughed like hell before I got around to tossing that mailing in the trash.
>
At the time I got a similar msg was only a week or 2 after I'd been
called a pie-rat by somebody in the support line in Redmond. My laugh
was as evil as I could manage as I hit the delete key.

The audacity of that outfit and its owner knows no bounds.
Now he & A.F.wants to kill off 98% of us.

Michael Stone

unread,
Jan 9, 2023, 4:00:06 PM1/9/23
to
On Sat, Jan 07, 2023 at 11:33:44AM +0000, Ottavio Caruso wrote:
>$ file test2/sm/SM.EXE
>test2/sm/SM.EXE: MS-DOS executable, MZ for MS-DOS
>
>Which makes me think it's DOS but it could be a false positive.

Nope, that's it. If it was windows it would say something like
"PE32+ executable (GUI) x86-64 (stripped to external PDB), for MS Windows"
the keywords being "PE" and "for MS Windows". 32 bit programs would be
"PE32" rather than "PE32+".

If you're running an ancient executable for an ancient (16bit) version
of windows it would show up as something like
"MS-DOS executable, NE for MS Windows (3.0)"

Virgo Pärna

unread,
Jan 12, 2023, 4:00:05 AM1/12/23
to
On Sat, 7 Jan 2023 11:33:44 +0000, Ottavio Caruso <ottavio2006...@yahoo.com> wrote:
> GROUPS.2 QWORDS.SM SM.EXE SM.OVR
> GROUPS.SM README.1ST SMHOME.HLP SM.PIF
> HAMWORDS.SM REGWORDS.SM SM.ICO SMRADIO.HLP
>

I do not have 16 bit Windows executables at hand for testing, so
I do not really know, it file command detects dos correctly.
But this particular file listing has SM.EXE and SM.PIF. Which
strongly suggests, that SM.EXE is dos program (because PIF file WIndows
configuration file for DOS VM used to execute that executable).

--
Virgo Pärna
virgo...@mail.ee

David

unread,
Jan 12, 2023, 4:40:06 AM1/12/23
to
On Sat, 7 Jan 2023 at 22:34, Ottavio Caruso
<ottavio2006...@yahoo.com> wrote:

> I have a few DOS/Windows abandonware that I'd like to check but I only
> want the DOS ones, because Wine on my installation is a total pain.

[...]

> $ file test2/sm/SM.EXE
> test2/sm/SM.EXE: MS-DOS executable, MZ for MS-DOS

> Which makes me think it's DOS but it could be a false positive. Then,
> how do I run it? Dosemu, Dosbox?

Hi, I just noticed that I had easy access to some archives here,
so I did some tests to compare with your 'find' output above.

Here is what the 'file' command reports when testing some
examples of *.COM and *.EXE files from MSDOS 6.20 and
MS Windows 3.1 operating system files.

[david@kablamm ~]$ file --version
file-5.39
magic file from /etc/magic:/usr/share/misc/magic

[david@kablamm MSDOS_6.20]$ file COMMAND.COM
COMMAND.COM: DOS executable (COM)

[david@kablamm MSDOS_6.20]$ file DEBUG.EXE
DEBUG.EXE: MS-DOS executable, MZ for MS-DOS Self-extracting PKZIP archive

[david@kablamm WIN_3-1]$ file WIN.COM
WIN.COM: DOS executable (COM)

[david@kablamm WIN_3-1]$ file NOTEPAD.EXE
NOTEPAD.EXE: MS-DOS executable, NE for MS Windows 3.x (EXE)

That seems to confirm your file SM.EXE as being MSDOS
compatible.

> Should that be run before or after uncompressing it?

The SM.EXE should be placed in the current directory
or PATH of an MSDOS compatible operating system
and run by typing SM at the DOS command prompt.
0 new messages