I've had similar problems, but found out a little bit more.
Problem
I have been trying to close a CMD window (run as administrator) which has set its own window title. So, run CMD as administrator and type:
title CMD with custom title
After much faffing, the following command showed me that setting the window title puts a leading space in front of the title! (No idea why.)
c:>tasklist /V /FI "WindowTitle eq Administrator*"
Image Name PID Session Name Session# Mem Usage Status User Name CPU Time Window Title
========== ==== ============ ======== ========= ======= =============== ======== =====================================
cmd.exe 4304 Console 1 2,492 K Running MACHINEMy Name 0:00:00 Administrator: CMD with custom title
??
(scroll ??) extra space
Solution
So to kill the process:
taskkill /F /FI "WindowTitle eq Administrator: CMD with custom title" /T
??
bingo
/F
- use the force.
/T
- kill child-processes.
If you're banging your head in a similar fashion, I recommend using tasklist
to poke around inside the process properties to make sure you're getting your filters right. This ballache brought to you by Windows 8.
Note: if the title contains quotation marks, just escape the nested ones:
title "CMD with custom title"
taskkill /F /FI "WindowTitle eq Administrator: "CMD with custom title"" /T
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…