www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/10/00:40:13

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199604100422.AA175530175@relay1.geis.com>
Date: Wed, 10 Apr 96 03:59:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Paths and .COM files

Reply to message 8970388    from ELIZ AT IS DOT ELTA. on 04/09/96  5:18AM


>That is correct, but for 2 minor points.  First, DOS doesn't search for
>the executable at all, it's COMMAND.COM (or whatever shell that you use)
>that does and submits it to DOS if it finds .com or .exe (DOS cannot
>execute .bat files).  Second, COMMAND.COM searches its list of internal
>commands first, so if you call your program dir.exe it cannot be invoked
>from the COMMAND.COM prompt.

Thanks for the clarification.  Is there any way to determine which commands
are builtin for any given shell program?  If I recall correctly the behavior of
Unix 'whence', it doesn't work with builtin commands, but I am curious anyway.

>> Does anybody here know exactly what would be required to go about
>> creating a .COM as opposed to an .EXE?
>
>Why would you need to do that (even if you could, which I think you
>don't)?  For the purpose of reporting the type of the program, it
>suffices to look at the first two bytes of the program file.  There is a
>library function called ``_is_executable'' that does just that.

Actually, I wanted to create "executables" of all three types (.BAT, .COM,
and .EXE) to test the order of COMMAND.COM's searching.  :)  In fact, if my
version of 'whence' is to work correctly, it can't depend on _is_executable,
because that doesn't report .BATs as executables, does it?  Even so, I
don't actually need to check to see if a given file is executable, just what
gets called first in the path.

John

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019