For using you should use powershell, that would be easy. Let me give the answer
1
For conditional operation, you can use powershell;
if(Get-Process -Name ProcessName)
{
"Process is running. So ending the process"
Get-Process -Name ProcessName | Stop-Process -Force
}
Else
{
"Process is not running"
}
Get-Process -Name "chromedriver" | Stop-Processin PowerShell.