[fpc-pascal]Changing the directory of the invoking shell

Rich Pasco pasco at acm.org
Fri May 17 18:33:10 CEST 2002

Can a Free Pascal program, compiled as a Win32 console application,
change the current directory of the invoking shell?  A Borland Pascal
program can.

Consider the program CHD.PAS containing


compiled into CHD.EXE.

I want a console session where I invoke it at the command prompt to look
like this:


and indeed, if I compile CHD.PAS with Borland Pascal for DOS (16-bit)
that is exacty what happens when I invoke it under the Windows 2000
shell CMD.EXE.

However, if I compile CHD.PAS under Free Pascal for Win32, then when I
invoke it (also under CMD.EXE), it produces:


In other words, it seems that while CHD may successfully chenge the
current directory for its own internal purposes, that change is not
propgated back to the shell from which it was invoked, as I want.
Can I remedy that?  How?

     - Rich

More information about the fpc-pascal mailing list