经过大约 10 年的不使用,我正在重新学习 Perl。
我从该站点上类似问题的答案之一复制并粘贴了以下两个脚本。我已经检查并仔细检查path
并尝试了几种偏差,但我仍然得到相同的答案 -
The system cannot find the path specified
任何帮助将不胜感激!
它确实到达starting child process
并退出并显示错误消息The system cannot find the path specified
。
下面是原两个脚本的剪切粘贴
父.pl:
#!/usr/bin/perl
use warnings;
use Win32;
use Win32::Process;
$| = 1;
my $p;
print "Starting child process ... \n";
Win32::Process::Create(
$p,
'c:\Perl\perl.exe',
'perl hello.pl',
1,
NORMAL_PRIORITY_CLASS,
'.',
) or die Win32::FormatMessage( Win32::GetLastError() );
print "Waiting three seconds before killing 'hello.pl'\n";
for (1 .. 3) {
print;
sleep 1;
}
$p->Kill(0)
or die "Cannot kill '$p'";
你好.pl
#!/usr/bin/perl
$| = 1;
print "Hello World\n";
print "Sleeping 1000 seconds\n";
for (1 .. 1000) {
sleep 1;
print '.';
}