taskkill window spaces in its title name

前端 未结 6 1878
耶瑟儿~
耶瑟儿~ 2020-12-13 13:33

I\'m trying to run taskkill on a console window that has spaces in it\'s title. How can I pass this window title to taskkill. I have tried the following:

tas         


        
6条回答
  •  情话喂你
    2020-12-13 14:34

    I guess this task run on your windows server . If the title includes "Administrator : " you can not kill the task via WindowTitle equal.

    You should use this : This is my killer.bat. SEARCH_PARAMETER = WHAT TITLE YOU WANNA KILL

    @echo off
                for /f "tokens=2 delims=," %%a in ('
    tasklist /fi "imagename eq cmd.exe" /v /fo:csv /nh 
    ^| findstr /r /c:".*SEARCH_PARAMETER[^,]*$" ') do taskkill /pid %%a
    

提交回复
热议问题