This example kills all but the most recent CMD.EXE on the local "." computer.

Test it by starting a few console sessions, then run the script - from the most recent console of course!

Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")

Dim $sComputer,$sExe
Dim $oWMI,$cProcesses,$oProcess,$sProcessDate,$oProcessHold

$sComputer="."
$sExe="CMD.EXE"

$oWMI=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+'\root\cimv2')
If @ERROR or VarType($oWMI)<>9 "Cannot create WMI object: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf
$cProcesses=$oWMI.ExecQuery("select * from Win32_Process where Name=" +'"'+$sEXE+'"')
If @ERROR or VarType($cProcesses)<>9 "Cannot create process collection: ["+@ERROR+"] "+@SERROR+@CRLF Exit @ERROR EndIf

For Each $oProcess in $cProcesses
If $sProcessDate=""
$oProcessHold=$oProcess
$sProcessDate=$oProcess.CreationDate
Else
If $oProcess.CreationDate > $sProcessDate
"Killing "+$oProcessHold.ProcessID+" which started at "+$oProcessHold.CreationDate+@CRLF
$oProcessHold=$oProcess
$sProcessDate=$oProcess.CreationDate
$=$oProcessHold.Terminate
If @ERROR "**ERROR**: Could not kill process ["+@ERROR+"] "+@SERROR+@CRLF EndIf
Else
"Killing "+$oProcess.ProcessID+" which started at "+$oProcess.CreationDate+@CRLF
$=$oProcess.Terminate
If @ERROR "**ERROR**: Could not kill process ["+@ERROR+"] "+@SERROR+@CRLF EndIf
EndIf
EndIf
Next

"Will not kill process "+$oProcessHold.ProcessID+" which started at "+$oProcessHold.CreationDate+@CRLF

Exit 0