Excel was the example I used, but you could use anything…Somebody on HardForums.com was asking about a way to kill all but the most recently started Excel process. I came up with this:
get-process | where-object { $_.name -eq "excel" } | sort-object -property "Starttime" -descending | select-object -skip 1 | foreach { taskkill /pid $_.id }
If there is just one excel process running, it will leave that process alone, thanks to the -skip 1 in Select-Object.
I can’t imagine this is too useful, but who knows? :)

