Tip of the Week: Batch Script Commands to Terminate Programs

Blog Post created by ken_foster on Apr 11, 2015

If you write batch scripts to install, update or remove Mentor Graphics software, then you might find this Tip of the Week useful.


It’s very important, particularly for our PCB flow software that has iCDB architecture, to make sure that programs are not running before you make any change to the system that affects them. Here are a few simple commands you could use in your batch scripts to avoid problems while installing, updating, or removing.


Many programs will gracefully close down a running instance if you run it again with a –close argument. This one will exit iCDB Server Manager. This is nice because you won’t get an error if the program is not currently running.


%SDD_HOME%\iCDB\win32\bin\iCDBServerManager.exe -close



Another way of doing it is to use the taskkill command. Unlike the command above, this will complain if the program isn’t running, and if it is running you’ll get confirmation that the process has been terminated. That’s useful if you really want to be sure one way or the other about the programs current status.


          start "Window name" /w /min cmd /c taskkill /f /im "iCDBServerMonitor.exe"


If the program is a service, then it supports the start, stop, and remove arguments in all likelihood. In this example, I’m stopping the RSCM service and then removing it. The call statements are there to ensure that the operation completes before the next command executes.


           echo Stopping and removing the RSCM service, if it is running...
           call "%SDD_HOME%\iCDB\win32\bin\iCDBNetLauncher.exe" –stop
           call "%SDD_HOME%\iCDB\win32\bin\iCDBNetLauncher.exe" –remove


I hope you find these commands useful!


Ken Foster

Mentor  Graphics Global Support and Services