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
The trick is to name the cmd process and then kill it by calling the name you have given: The following is starting 6 parallel processes and you can kill any one of choice.
start "cmd001" cmd.exe
start "cmd002" cmd.exe
start "cmd003" cmd.exe
start "cmd004" cmd.exe
start "cmd005" cmd.exe
start "cmd 006" cmd.exe
:: kill the process you want, e.g. cmd005
taskkill /F /FI "WINDOWTITLE eq cmd005" /T
:: kill a process which has a SPACE in its name, e.g. cmd 006
taskkill /F /FI "WINDOWTITLE eq cmd 006" /T