• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Perl [Perl] Funcion cmd()

Status
Not open for further replies.

Doddy

Leech
User
Joined
Apr 1, 2012
Messages
169
Reputation
0
Reaction score
406
Points
63
Credits
0
‎13 Years of Service‎
57%
Hola a todos

Acabo de hacer esta funcion cmd() para poder ejecutar comandos de forma comoda

Code:
>
#By Doddy H

use Win32::Job;

sub cmd {

my $job = Win32::Job->new;
$job->spawn("cmd",qq{cmd /C $_[0]},{
no_window => "true",
stdout => "logx.txt",
stderr => "logx.txt"
}
);
$ok = $job->run("30");

open (F,"logx.txt");
@words = ;
close F;

unlink("logx.txt");

return @words;

}
Ejemplo de uso

Code:
>
@re = cmd("ver");
print @re;
 
Status
Not open for further replies.
Back
Top