Close chrome from bat file

后端 未结 2 1239
有刺的猬
有刺的猬 2021-02-15 16:53

I am trying to kill chrome from bat file. Tried

TASKKILL /IM chrome.exe /F

but it doesnt close the chrome. What is the correct way to do that ?

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-15 17:07

    You'll want to use the same command, but with the /T argument, like so:

    taskkill /F /IM chrome.exe /T
    

    The /T argument kills the process and all of its child processes. Effectively, it should close all processes with the same process name that you provide in the argument list.

    If you'd like to suppress errors/output, pipe the ouput to nul, like this:

    taskkill /F /IM chrome.exe /T > nul
    

    Regardless of the method you use, you must run the batch file as an Administrator to kill the chrome.exe processes.

提交回复
热议问题