Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Process 如何使用DOS'结束特定进程(.hta);taskkill还是类似的?_Process_Task_Dos_Hta_Taskkill - Fatal编程技术网

Process 如何使用DOS'结束特定进程(.hta);taskkill还是类似的?

Process 如何使用DOS'结束特定进程(.hta);taskkill还是类似的?,process,task,dos,hta,taskkill,Process,Task,Dos,Hta,Taskkill,很多时候,我会运行多个.hta文件,但只想终止一个特定的文件。在任务管理器中,它们都在“进程”选项卡下命名为mshta.exe*32,但如果单击“应用程序”选项卡,我可以通过查看其唯一标题来识别要终止的特定.hta。例如,在下图中,您可以看到.hta名为“Review Menu”。但在下一张图像中,您会看到它隐藏在进程选项卡中名为mshta.exe*32的其他正在运行的.htas中 是否有类似于TASKKILL/F/IM mshta.exe的命令,我可以使用它来指定仅关闭“查看菜单”实例?提前谢

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

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

应用程序选项卡:

进程选项卡:


您可以尝试以下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
'**********************************************************************************************

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

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

请看,它包含了一个关于如何使用终止进程的粗略示例。您的意思是希望像杀手选择器一样终止进程吗?