Thread overview | |||||
---|---|---|---|---|---|
|
May 29, 2011 Anyone know why system change directory calls don't work? | ||||
---|---|---|---|---|
| ||||
E.g.: import std.process; system(r"cd C:\newfolder"); // no effect It just stays in the same folder as the exe. I can use SetCurrentDirectoryA as an alternative, but why doesn't it work via the system call? |
May 29, 2011 Re: Anyone know why system change directory calls don't work? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On Sun, 29 May 2011 00:54:10 -0400, Andrej Mitrovic wrote:
> E.g.:
>
> import std.process;
> system(r"cd C:\newfolder"); // no effect
>
> It just stays in the same folder as the exe. I can use SetCurrentDirectoryA as an alternative, but why doesn't it work via the system call?
Because system starts a shell process -- the cd only affects that process, not the parent process (that's you!).
|
May 29, 2011 Re: Anyone know why system change directory calls don't work? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bernard Helyer | Oh ok. I thought console apps would automagically follow cd calls invoked via system. I got it wrong. Thanks. |
Copyright © 1999-2021 by the D Language Foundation