How to terminate a process in vbscript

前端 未结 3 2003
余生分开走
余生分开走 2020-12-09 18:47

How can I terminate process using vbscript. PLEASE NOTE, I need to terminate process that runs under windows 64-bit environment as native 64 (not using select * from win_32_

相关标签:
3条回答
  • 2020-12-09 19:15
    Dim shll : Set shll = CreateObject("WScript.Shell")
    Set Rt = shll.Exec("Notepad") : wscript.sleep 4000 : Rt.Terminate
    

    Run the process with .Exec.

    Then wait for 4 seconds.

    After that kill this process.

    0 讨论(0)
  • 2020-12-09 19:32

    The Win32_Process class provides access to both 32-bit and 64-bit processes when the script is run from a 64-bit command shell.

    If this is not an option for you, you can try using the taskkill command:

    Dim oShell : Set oShell = CreateObject("WScript.Shell")
    
    ' Launch notepad '
    oShell.Run "notepad"
    WScript.Sleep 3000
    
    ' Kill notepad '
    oShell.Run "taskkill /im notepad.exe", , True
    
    0 讨论(0)
  • 2020-12-09 19:34

    Just type in the following command: taskkill /f /im (program name) To find out the im of your program open task manager and look at the process while your program is running. After the program has run a process will disappear from the task manager; that is your program.

    0 讨论(0)
提交回复
热议问题