请问能不能写个批处理文件,对Tomcat5.5.25启动,停止,重起进行控制呢?因为觉得每次点任务栏那个图标有点麻烦

解决方案 »

  1.   

    可以控制启动停止,通过调用TOMCAT自带的批处理来完成,当然,你要保证你设置了tomcat的环境变量CATALINA_HOME
    这是启动的批处理:
    @echo off
    call "%CATALINA_HOME%\bin\startup.bat"
    这是停止的批处理:
    @echo off
    "%CATALINA_HOME%\bin\shutdown.bat"
    这是停止的批处理:
    @echo off
    "%CATALINA_HOME%\bin\shutdown.bat"
    call "%CATALINA_HOME%\bin\startup.bat"
    这是可以一起用的批处理(如果想启动停止一起用的话,下面这个批处理需要在命令提示行下运行,带参数,参数为1则启动,2则停止,不输入的话默认为重起,这样的话也可以直接双击运行):
    @echo off
    if NOT "%1"=="" goto restart
    if "%1"=="1" goto start
    if "%1"=="2" goto stop:restart
    "%CATALINA_HOME%\bin\shutdown.bat"
    call "%CATALINA_HOME%\bin\startup.bat"
    call "%CATALINA_HOME%\bin\startup.bat":start
    call "%CATALINA_HOME%\bin\startup.bat":stop
    call "%CATALINA_HOME%\bin\shutdown.bat"
      

  2.   

    @echo off 
    if NOT "%1"=="" goto restart 
    if "%1"=="1" goto start 
    if "%1"=="2" goto stop 
    把NOT去掉,忘了去了,呵呵
      

  3.   

    5.5.25版本貌似没有这两个东东吧?
    startup.bat
    shutdown.bat
      

  4.   

    net start tomcat5  //启动tomcat5
    net stop tomcat5   //关闭tomcat5
      

  5.   

    我用的是5.5.26版本的,应该没什么区别吧,对了,是解压缩版的~
    楼上的命令是启动和关闭tomcat服务,也就是说只有把tomcat先注册成服务后才有用
      

  6.   

    net stop tomcat5  //关闭tomcat5
    net start tomcat5  //启动tomcat5