Perl directory change from Windows cmd.exe

chdir, cmd, perl

Solution

When a shell runs a program, it essentially forks then execs the program -- in this case, your perl script. The directory within that forked process has been changed, and then that process dies. You're then returned to the original shell process.

Problem

According to the manual, chdir, Changes the working directory to `EXPR`, if possible. This script, when executed from cmd.exe: ``` my $path = 'C:\\some\\path\\'; print "$path\n"; chdir("$path") or die "fail $!"; ``` results in this output: ``` C:\some\path\ ``` but when I am returned to the command prompt - I'm still at the original directory. Am I misunderstanding the purpose of chdir?

Original source

Related problems