in reply to Re^4: Perl calling command prompt?
in thread Perl calling command prompt?

Why don't you just invoke the batch file via it's fully-qualified-path-name like this?
system("cmd /c \"E:\\MyPerl\\Trial_Scripts\\batch_file.bat\"");

or if you still wish to change directories,
system("cd E:\\MyPerl\\Trial_Scripts && batch_file.bat");

Just don't count on system("cd ...") changing the current directory over the lifetime of the perl script, It only changes directories for that particular instance of system() (or rather, changes directories for the shell that is invoked via system()). As soon as system() returns, perl continues operating in the directory it was in before system() was called.

Or if you wish for a persistent directory change, use perl's own chdir().

update: just cleaned up some nasty formatting error


perl -e '$,=$",$_=(split/\W/,$^X)[y[eval]]]+--$_],print+just,another,split,hack'er