c:\src\perl-5.8.7> cd win32 c:\src\perl-5.8.7> dmake c:\src\perl-5.8.7> dmake test c:\src\perl-5.8.7> dmake install #### programs\perl\bin\perl.exe src\perl\autostart.pl #### use strict; use warnings; use File::Spec; my $cur_dir = File::Spec->curdir(); $cur_dir = File::Spec->rel2abs unless ( File::Spec->file_name_is_absolute($cur_dir) ); my $drive = (File::Spec->splitpath($cur_dir))[0]; $drive .= '\\'; my @paths = ( 'programs\\perl\\bin', 'programs\\bin', 'programs\\dmake', 'programs\\usr\local\wbin' ); my $path = '%PATH%;'; foreach my $item (@paths) { my $tmp = File::Spec->catpath($drive,$item); $path .= File::Spec->canonpath($tmp) . ';'; } my $path_cmd = "set path=$path"; print "Current directory: $cur_dir\n"; print "Current drive: $drive\n"; print "Path to be set: $path_cmd\n"; exec ("cmd.exe /K $path_cmd") or die "Couldn't exec cmd.exe: $!\n";