TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Francois Thunus
from: Peter Fitzsimmons
date: 1995-04-02 20:02:46
subject: dossetcurrentdir

PF> The current directory is considered part of the current operating
 PF> environment,  so a child program can not change 
 PF> the current dir of the
 PF> parent.

 FT> OK. That's what I was afraid of. But I could modify 
 FT> the parent's environment
 FT> from within the child process, if I knew what value to alter, right ?

With the right device driver,   I suppose you could -- but this would be
very dangerous.   Don't forget that this is a true multitasking OS --the
parent program that spawned you may still be actively running and using its
current directory;  you simply just can't go and change it!

 FT> that's an idea, but I'd rather have a real program.
 FT> How about the REXX

Since rexx scripts aren't real programs (they are interpreted by cmd.exe),
and are not chilren of cmd.exe (but are run BY cmd.exe),  any changes you
make to the current dir will still be in effect when cmd.exe displays the
command prompt.

But calling rexx from inside a C program will not work as you want,  for
the original reason.

If this is a solution you want only for yourself,  and the intent is to
change the dir for a command prompt (and not some other parent pgm) call
Brady Flower's bbs (author of TE/2).  He wrote a cmd.exe replacement some
time ago that has an API for child programs to communicate with it --- one
of the features was to have the command interpreter change to the specified
dir.


--- Maximus/2 2.02p1
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/702 3615/50 396/1 270/101 105/103 42 712/515
@PATH: 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.