0

I wrote a bat file to install Tomcat 7.0.73 and start its service:

SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_80
CD /D Server\apache-tomcat-7.0.73\bin\
service install MyTomcat
SLEEP 5
sc start MyTomcat

But there are 2 problems:

  1. After service install MyTomcat, It exits and It does not perform the command sc start MyTomcat;
  2. How can I change the script in order to start MyTomcat in a persistent way?
6
  • 1
    By default (at least on Windows 7) there is no command service and no command sleep. You would probably have to look into the documentation of those commands to figure out why it's not working the way you want and/or provide more context.
    – Seth
    Jan 23, 2017 at 12:18
  • Thanks, but I am working with Windows 10
    – user688995
    Jan 23, 2017 at 12:25
  • Which doesn't have a service command either, by default. So you will still need to provide context on where that command is coming from or check the help yourself, likely by running service /? or service -h.
    – Seth
    Jan 23, 2017 at 12:34
  • 1
    If service is another batch file then call it.
    – DavidPostill
    Jan 23, 2017 at 13:26
  • Why have you deleted your account? Doing so means we can't @comment reply to you ...
    – DavidPostill
    Jan 23, 2017 at 13:29

0

You must log in to answer this question.