Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!killer!jls From: jls@killer.DALLAS.TX.US (Jerome Schneider) Newsgroups: comp.sys.ibm.pc Subject: Re: Execution Order Summary: Command.com sets the search order Keywords: COM EXE BAT Message-ID: <7237@killer.DALLAS.TX.US> Date: 20 Feb 89 04:41:34 GMT References: <992@expya.cs.exeter.ac.uk> <22@dbase.UUCP> Organization: The Unix(R) Connection, Dallas, Texas Lines: 37 In article <22@dbase.UUCP>, marc@dbase.UUCP (Marc Schifer) writes: > In article <992@expya.cs.exeter.ac.uk>, sru@cs.exeter.ac.uk (Steve Rush) writes: > > I have a question about execution order in MSDOS. I beleive that > > commands in MSDOS are executed in the order .COM .EXE .BAT so if there > > are several files in the directory with the same name but with > > different extensions it is the .COM file that would be executed. > > [question about circumventing this is deleted] > > Thanks in advance for any suggestions. > > Steve > Try renaming the .EXE file to something else (ie XFILE.EXE) > this way you eliminate the looping.(of course it still allows > someone to execute the original file on its own.) IF your > com file is calling the exe file internaly you may try using > some nonstandard characters in the second files name to > slow down the average user from accessing the file. > hope this helps > marc Steve's observation about the COM EXE BAT search order is correct. When command.com tries to run a program, the extension is stripped off and the three extensions are appended, one at a time, while the PATH is searched for a matching file. The first match found is the file executed. The three extensions are stored near the very end of the COMMAND.COM file and it might be possible to hack command.com to alter the search order, but your problem with the PATH search sequence will reamain. As a side note, the EXE extension on a file is not really used by the loader -- a magic number in the first two bytes identifies a relocatable module, even if it is called foo.bar. However, this trick is probably valid only from a spawn() call that bypasses COMMAND.COM. It would appear, then, that DOS will frustrate any attempts to modify the search sequence. -- Jerome Schneider UUCP: killer!jls.DALLAS.TX.US (guest account) Aspen Technology Group Ft. Collins, CO Voice: (303) 484-8466