Is it possible to "kill" a windows process if I know the name of that process? Is it possible to know it's PID that is displayed in the system manager?
I've not done enough Windows-specific programming to know if you can kill another executing program given just its name. My best advise is to go to the Tcl'ers Wiki (
I posted a solution based on this wiki post and
the freely available nature of the kill and tlist utilities for windows. win2k comes with both. win9x
has them in the reskit directory of the cd-rom.
Here is some example code that you can perfect.
proc Lpick {{x "0"}} {
global arra
set lis [exec tlist]
foreach el [split $lis "\n"] {
puts $el
regexp "\[0-9\]+ \[a-zA-Z\]+.exe" $el all
catch {set arra([incr x]) $all}
}
}
proc KillIt {name} {
global arra
foreach poss [array name arra] {
set id [lindex [split $arra($poss) " "] 0]
set pname [lindex [split $arra($poss) " "] 1]
if {[string compare $name $pname] == 0} {
puts "Killing $name now."
exec kill $name
}
}
return
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.