如何使用DOS'结束特定进程(.hta) taskkill或类似?

时间:2015-08-09 23:48:53

标签: process task dos hta taskkill

很多时候我会运行多个.hta文件,但只想终止特定文件。在任务管理器中,它们在进程选项卡下都被命名为 mshta.exe * 32 ,但如果我单击应用程序选项卡,我可以使用它能够通过查看他们独特的标题来识别特定的.htas终止。例如,在下图中,您会看到.hta被命名为" Review Menu"。但是在下一张图片中,您会看到它隐藏在另一张图片中.htas在进程标签中全部命名为 mshta.exe * 32

是否有类似TASKKILL /F /IM mshta.exe的命令,我可以使用它来指定关闭"查看菜单"实例?提前谢谢。

应用程序标签:

one

ProcessesTab:

two

2 个答案:

答案 0 :(得分:1)

您可以在dos提示符下执行此操作:

taskkill /F /IM mshta.exe /fi "WINDOWTITLE eq Review Menu"

答案 1 :(得分:0)

您可以尝试使用此vbscript: KillerSelector.vbs

Option Explicit
Dim Titre,Copyright,fso,ws,NomFichierLog,temp,PathNomFichierLog,OutPut,Count,strComputer
Copyright = "[(c) Hackoo (c) 2014 ]"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject( "Wscript.Shell" )
NomFichierLog="Process WScript.txt"
temp = ws.ExpandEnvironmentStrings("%temp%")
PathNomFichierLog = temp & "\" & NomFichierLog
Set OutPut = fso.CreateTextFile(temp & "\" & NomFichierLog,1)
Count = 0 
strComputer = "."
'Call Find("wscript.exe")
Call Find("mshta.exe")
Call Explorer(PathNomFichierLog)
'***************************************************************************************************
Function Explorer(File)
    Dim ws
    Set ws = CreateObject("wscript.shell")
    ws.run "Explorer "& File & "\",1,True
end Function
'***************************************************************************************************
Sub Find(MyProcess)
    Dim colItems,objItem,Process,Question
    Titre = " Process "& DblQuote(MyProcess) &" running "
    Set colItems = GetObject("winmgmts:").ExecQuery("Select * from Win32_Process " _
    & "Where Name like '%"& MyProcess &"%' AND NOT commandline like '%" & wsh.scriptname & "%'",,48)
    For Each objItem in colItems
        Count= Count + 1
        Process = Mid(objItem.CommandLine,InStr(objItem.CommandLine,""" """) + 2) 'Extraction du chemin du script en ligne de commande
        Process = Replace(Process,chr(34),"")
        Question = MsgBox ("Do you want to stop this application : "& DblQuote(Process) &" ?" ,VBYesNO+VbQuestion,Titre+Copyright)
        If Question = VbYes then
            objItem.Terminate(0)'Kill this Process
            OutPut.WriteLine DblQuote(Process)
        else
            Count= Count - 1 'décrementer le compteur de -1
        End if
    Next
OutPut.WriteLine String(100,"*")
OutPut.WriteLine count & Titre & "were stopped !"
End Sub
'**********************************************************************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************