如何在Windows XP上使用Perl运行可执行文件? [英] How to run an executable file using Perl on Windows XP?
本文介绍了如何在Windows XP上使用Perl运行可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用perl运行可执行文件?
How to run an executable file using perl?
例如,我想运行一个普通的notepad.exe.我怎么能做到这一点?
For instance, i want to run a plain notepad.exe. How could I achieve this?
这就是我所拥有的:
my @args = system("notepad.exe");
system(@args) == 0 or die "system @args failed: $?";
但是它返回:
Can't spawn "cmd.exe": No such file or directory blah blah blah.
我想念什么?
推荐答案
尝试一下.
my $prog = "C:\\strawberry\\perltest\\Extractor.bat";
if (-f $prog) # does it exist?
{
print "Will run notepad";
system($prog);
}
else
{
print "$prog doesn't exist.";
}
这篇关于如何在Windows XP上使用Perl运行可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文