你的分享就是我们的动力 ---﹥

Perl 创建控制台模式的进程窗口

时间:2013-05-30 00:05来源:www.chengxuyuans.com 点击:

代码简介

暂无

Perl代码片段

#!/usr/bin/perl -w

use Win32;
use Win32::Process;

$ApplicationName = 'c:/perl/bin/perl.exe';
$CommandLine     = "perl your.pl";

Win32::Process::Create($ProcessObj,
    $ApplicationName,
    $CommandLine,
    0, # Don't inherit.
    CREATE_NEW_CONSOLE,
    ".") # current dir.
    or die print_error;

$ProcessObj->Wait(INFINITE) or warn print_error();

$ProcessObj->GetExitCode($ExitCode) or warn print_error();

print "Perl exited with $ExitCode\n";

sub print_error {
    print Win32::FormatMessage( Win32::GetLastError() );
}

#your.pl
#!/usr/bin/perl -w

#$enter = '';  
#print "Press Enter to quit.\n";
#$enter = <STDIN>;

转载注明地址:http://www.chengxuyuans.com/Perl/63090.html