I know we could do this in VBS, PowerShell, etc. However, we do not want to do this with another language other than good ol' batch script.
Have figured out the following:
TASKKILL /F /IM "tomcat*"
And this will forcibly kill/stop any persistent instances of Tomcat. Also, this would cover Tomcat6.exe, Tomcat6_1.exe, tomcat7.exe, and so on.
What my question is.. We know we can do a NET START Tomcat6, for example.. Is it possible to a:
NET START Tomcat*
? Yes, I am fully aware if you have multiple instances of Tomcat on a server, this would fail as you would have to iterate through the instance list.. However, the reason I am looking at doing this is because, I have monthly script we have to run and I am trying to make the batch script be more portable.
Thanks.
You can use WMIC commands with wildcards to accomplish this:
See Wildcard Services restart on the Super User site.