Wildcard with stop / start service
I know we could do this in VBS, PowerShell, etc. However, we don't want to do this with a language other than the good ol package.
Found out the following:
TASKKILL /F /IM "tomcat*"
And that will force kill / stop any persistent Tomcat instances. Also, this will cover Tomcat6.exe, Tomcat6_1.exe, tomcat7.exe, etc.
What is my question. We know we can do NET START Tomcat6 for example .. Is it possible:
NET START Tomcat*
? Yes, I'm fully aware of the fact that you have multiple Tomcat instances on the server, this will fail as you have to iterate over the list of instances. However, the reason I am looking at this is because I have a monthly script we need to run and I am trying to make the batch script more portable.
Thank.
source to share
You can use wildcard WMIC commands to accomplish this:
wmic service where "name like 'tomcat%'" call stopservice
See Restarting Wildcard Services on the Superuser Site.
source to share