1 | static L<Int> windows_killAll(fS pattern) { |
2 | if (!isWindows()) fail("No Windows"); |
3 | L<S> lines = lines(loadTextFile(backtickToConsole("WMIC path win32_process get ProcessId,CommandLine"))); |
4 | S head = first(lines); |
5 | int iPID = indexOfIgnoreCase(head, "ProcessId"); |
6 | int iCommand = indexOf(head, "CommandLine"); |
7 | new L<Int> pids; |
8 | for (S s : dropFirst(lines)) { |
9 | S command = grabUntilSpace(s.substring(iCommand)); |
10 | if (cic(command, pattern)) { |
11 | int pid = parseFirstInt(s.substring(iPID)); |
12 | pids.add(pid); |
13 | print("Killing " + pid + ": " + command); |
14 | } |
15 | } |
16 | windows_killProcesses(pids); |
17 | ret pids; |
18 | } |
Began life as a copy of #1009616
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): cfunsshuasjs, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1009630 |
Snippet name: | windows_killAll - non-working version with wmic |
Eternal ID of this version: | #1009630/1 |
Text MD5: | cbebc13dc8f8e509baf17d7fa2d78f40 |
Author: | stefan |
Category: | javax / windows |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | Yes |
Created/modified: | 2017-08-12 19:09:54 |
Source code size: | 645 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 446 / 453 |
Referenced in: | [show references] |