@if "%_echo%" == "" @echo off

setlocal

if x%1==x/k goto useoldkill
if "%NO_TASKKILL%"=="1" goto useoldkill

goto usenewkill

:useoldkill
set killcmd=kill /f
goto dokill

:usenewkill
set killcmd=taskkill /f /im
goto dokill

:dokill
echo on

net stop ehrecvr
net stop ehsched
%killcmd% RecordingObjectsTest.exe
%killcmd% ehshell.exe
%killcmd% ehremote.exe
%killcmd% ehtray.exe
%killcmd% ehrec.exe
%killcmd% eh*
%killcmd% MCInstaller.exe
%killcmd% MCSetup.exe

@if "%_echo%" == "" @echo off
set killcmd=

rem
rem NickFa - Added to stop the ServiceBus service, else \platform\servicebus will fail to build.
rem Right now, if neither of the first two parameters is -sbstop, then don't do this. This
rem allows install.cmd to work properly.
rem
if "%2"=="-sbstop" goto sbstop
if "%1"=="-sbstop" goto sbstop

goto exit

:sbstop

@echo ****** Stopping ServiceBus NT Service
%SystemRoot%\system32\net stop ServiceBus

:exit
