【问题标题】:Killing running processes on some other machine (over the network) using Delphi?使用 Delphi 杀死其他机器(通过网络)上正在运行的进程?
【发布时间】:2011-11-23 11:50:11
【问题描述】:

如何使用 Delphi 杀死其他机器(通过网络)上正在运行的进程?

【问题讨论】:

  • 修改RRUZ的answer;只需将 WQL 查询更改为 SELECT * FROM Win32_Process WHERE Name = TheProcessNameYouWantToKill 并调用 FWbemObject.Terminate。
  • 我想在 delphi 中做,而不是使用命令提示符 ;)
  • @DVDavy 使用上面建议的 WMI 或 CreateProcesstaskkill /s 以获得快速胜利!
  • 我用 WMI 做到了 :)) Thnx ;)
  • @DVDavy,别忘了接受答案。 Here 展示了你是如何做到的;)

标签: delphi networking process kill


【解决方案1】:

您需要的一切都可以在 The Road to Delphi 找到,他刚刚在 11 月 6 日发布了有关如何执行此操作的博客,请查看此链接 WMI Tasks using Delphi – Processes

【讨论】:

    【解决方案2】:

    您可以使用WTSTerminateProcess API 或使用Jwscl(Windows 安全库)Terminal Server unitTJwWTSProcess 类提供 Terminate 方法)。

    小代码示例:

    var 
      TS: TJwTerminalServer;
    begin
      TS := TJwTerminalServer.Create('Remote');
      try
        if TS.EnumerateProcess then
        begin
          for i := 0 to TS.Processes.Count -1 do
          begin
            if TS.Processes[i].Name = 'notepad.exe' then
            begin
               TS.Processes[i].Terminate;
            end;
          end;
        end;
      finally
        TS.Free;
      end;
    end;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-23
      • 1970-01-01
      • 1970-01-01
      • 2019-02-18
      • 1970-01-01
      • 1970-01-01
      • 2014-11-01
      • 2014-08-18
      相关资源
      最近更新 更多