制作了这个脚本:
#!/usr/local/bin/perl
#simple export from win-services with current state v. 0.1
use Win32::Service;
#hash-code for service reasons
my %statcodeHash = (
'1' => 'STOPPED',
'4' => 'RUNNING',
'7' => 'PAUSED'
);
my %serviceHash;
#Going to get the data from services and export
Win32::Service::GetServices("", \%serviceHash);
foreach $key(keys %serviceHash){
my %statusHash;
Win32::Service::GetStatus("", $serviceHash{$key}, \%statusHash);
if ($statusHash{"CurrentState"} =~ /[1-7]/){
print $serviceHash{"$key"} . "THE SERVISE IS " . $statcodeHash{$statusHash{"CurrentState"}} . "\n";
}
}
我怎样才能把脚本给我的所有数据放到我硬盘上的 .txt 文件中?
这些脚本显示了我系统中的哪些服务,哪些正在运行,哪些没有。我想将此导出到 .txt 文件
谢谢