终端服务器上的关闭进程(Windows 2008,x64)

时间:2013-03-19 12:47:21

标签: process windows-server-2008 autohotkey

Windows Sever 2008(x64)下的进程关闭功能方面需要一些帮助。 当我在Win7(x64)上运行此代码时,它会完全杀死进程,但是当我在终端用户会话(W2k8,x64)下运行它时,它会检测其他用户和关闭cource的进程,无法关闭它。我该如何解决?有什么想法吗?

脚本代码:

check:
{
Process, Exist, name.exe
Msgbox,ErrorLevel: %ErrorLevel%
NewID = %ErrorLevel%
Msgbox,ErrLev: %ErrorLevel% / NewID: %NewID%
if NewID = 0
{
      Msgbox, Nothing to close ;)
      return
}
else
{
      {
  Sleep, 500
      Msgbox, Something seems to be opened...
      Process, Close, name.exe
      Msgbox,Closed(ErrLev=%ErrorLevel%) (NewID=%NewID%)
      Sleep, 100
      Goto, check
      }
}
}

1 个答案:

答案 0 :(得分:0)

通过AutoHotKey获取UserName看起来很困难,为什么不使用PowerShell(也许通过AutoHotKey启动)。

以下是两个例子:

Process Owner
Process Name

相关问题