Can anyone help me close this program in VBScript?

后端 未结 3 1769
日久生厌
日久生厌 2020-12-20 10:02
MsgBox (\"Do you want to start the autoclicker?\", vbOkOnly, \"Autoclicker\")
CreateObject(\"WScript.Shell\").Run(\"\"\"C:\\         


        
3条回答
  •  我在风中等你
    2020-12-20 11:03

    I made before a script that ask you what vbscript did you want to kill and log the result into file.

    So just, give a try :

    Option Explicit
    Dim Titre,Copyright,fso,ws,NomFichierLog,temp,PathNomFichierLog,OutPut,Count,strComputer
    Copyright = "[© Hackoo © 2014 ]"
    Titre = " Process "& DblQuote("Wscript.exe") &" running "
    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 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,Processus,Question
        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
            Processus = Mid(objItem.CommandLine,InStr(objItem.CommandLine,""" """) + 2) 'Extraction of the commandline script path
            Processus = Replace(Processus,chr(34),"")
            Question = MsgBox ("Did you want to stop this script : "& DblQuote(Processus) &" ?" ,VBYesNO+VbQuestion,Titre+Copyright)
            If Question = VbYes then
                objItem.Terminate(0)'Kill this process
                OutPut.WriteLine DblQuote(Processus)
            else
                Count= Count - 1 'decrement the counter -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
    '**********************************************************************************************
    

提交回复
热议问题