[fpc-pascal]chdir problem? -- 2nd request

James_Wilson at i2.com James_Wilson at i2.com
Tue Jan 9 15:35:46 CET 2001

> This is no permanent directory, either, but the very same you have
> in your own programs. While a program is running, let that be a
> small utility, an complex application or a command interpreter,
> there is a current directory it keeps. Whenever you issue that CD
> command, you change the current directory of *that copy* of
> CMD.EXE, nothing else. If you have several DOS prompts running,
> they will not influence each other and as soon as you exit any of
> them, the current directory vanishes with the program. There is
> simply no way to solve this otherwise in a multitasking operating
> system.

> But you could tell us why you want to modify the current directory
> of a program from another one (as far as I can tell, this is what
> you actually aim to do). We might come up with an alternative
> solution.

With all the confusion I seem to have created perhaps the problem is that I
haven't properly stated my intentions. This is what I'm trying to do:

I have a command line (text-mode) filefind type of program that I
developed. You know; search by date, time, size, attribs, etc. One of the
options is 'goto directory' of the found file. So, you can search for
anyfile.name and have it find the file, CD into the directory where the
file is and then exit (leaving you at the DOS prompt, but in the directory
of the file you were searching for). The go32 targets work just fine, but
the Win32 targets leave you in the directory that the program was launched
from and not the directory where the file was found.


Jim Wilson

More information about the fpc-pascal mailing list