use Win32::OLE; my $wmi = Win32::OLE->GetObject("winmgmts:") or die "wmi connect failed!"; my $P = $wmi->ExecQuery("SELECT * FROM Win32_Process") or die "Win32_Process connect failed!"; foreach my $p (in $P) { print join(',' , $p->ProcessId, $p->Name, $p->CommandLine)."\n"; }