Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!rutgers!njin!princeton!siemens!demon!jrv From: jrv@demon.siemens.com (James R Vallino) Newsgroups: comp.sys.ibm.pc Subject: Re: Finding a program's path. Message-ID: <13343@siemens.siemens.com> Date: 8 Aug 89 13:39:48 GMT References: <7207@ecsvax.UUCP> <36047@bu-cs.BU.EDU> Sender: news@siemens.siemens.com Reply-To: jrv@demon.siemens.com (James R Vallino) Organization: Siemens Research and Technology Laboratories Lines: 27 In article <36047@bu-cs.BU.EDU> madd@bu-it.bu.edu (Jim Frost) writes: >In article <7207@ecsvax.UUCP> harris@ecsvax.UUCP (Mark Harris) writes: >|I am writing a program which needs to know the path through which >|it was loaded (rather than the current working directory). DOS >|3.x puts this path in the environment, but DOS 2.x doesn't. Is >|there a reasonably simple way to find this path in DOS 2.x? > >No. One way to do it is to compile the name of the program in and run >a path search until you find it. Unfortunately if you rename the >program this is a problem >or if you give an absolute path (either to override the path >or to get to an executable which is not on the path) not a problem because if I remember correctly back to the dark ages DOS 2.x would not let you specify an absolute path to an executable. >you will not be >able to find the executable. Jim Vallino Siemens Corporate Research, Princeton, NJ jrv@demon.siemens.com princeton!siemens!demon!jrv (609) 734-3331