[关闭]
@cyysu 2017-10-12T10:20:09.000000Z 字数 1984 阅读 949

Bat-实战基础篇(六)

  • 时间:2017年10月11日
  • 作者:Kali
  • 邮箱:cyysu.github.io@gmail.com/2869905223@qq.com/微信lwyx1413
  • 版本:4.0
  • 描述:批处理实战基础篇六,主要讲解tomcat下启动脚本,本文主要讲解shutdown.bat这个脚本

Bat系列教程


项目实战

  1. # shutdown.bat
  2. :: 这里和之前的脚本差不多,此脚本不做过多介绍,大家看到此篇文章时,我们可以发现某一类的批处理文件都具有一定的框架,按照这个框架设计的脚本大部分都类似,后面几个脚本如果有新的知识点我会贴出来。
  3. @echo off
  4. rem Licensed to the Apache Software Foundation (ASF) under one or more
  5. rem contributor license agreements. See the NOTICE file distributed with
  6. rem this work for additional information regarding copyright ownership.
  7. rem The ASF licenses this file to You under the Apache License, Version 2.0
  8. rem (the "License"); you may not use this file except in compliance with
  9. rem the License. You may obtain a copy of the License at
  10. rem
  11. rem http://www.apache.org/licenses/LICENSE-2.0
  12. rem
  13. rem Unless required by applicable law or agreed to in writing, software
  14. rem distributed under the License is distributed on an "AS IS" BASIS,
  15. rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. rem See the License for the specific language governing permissions and
  17. rem limitations under the License.
  18. rem ---------------------------------------------------------------------------
  19. rem Stop script for the CATALINA Server
  20. rem ---------------------------------------------------------------------------
  21. setlocal
  22. rem Guess CATALINA_HOME if not defined
  23. set "CURRENT_DIR=%cd%"
  24. if not "%CATALINA_HOME%" == "" goto gotHome
  25. set "CATALINA_HOME=%CURRENT_DIR%"
  26. if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
  27. cd ..
  28. set "CATALINA_HOME=%cd%"
  29. cd "%CURRENT_DIR%"
  30. :gotHome
  31. if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
  32. echo The CATALINA_HOME environment variable is not defined correctly
  33. echo This environment variable is needed to run this program
  34. goto end
  35. :okHome
  36. set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
  37. rem Check that target executable exists
  38. if exist "%EXECUTABLE%" goto okExec
  39. echo Cannot find "%EXECUTABLE%"
  40. echo This file is needed to run this program
  41. goto end
  42. :okExec
  43. rem Get remaining unshifted command line arguments and save them in the
  44. set CMD_LINE_ARGS=
  45. :setArgs
  46. if ""%1""=="""" goto doneSetArgs
  47. set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
  48. shift
  49. goto setArgs
  50. :doneSetArgs
  51. call "%EXECUTABLE%" stop %CMD_LINE_ARGS%
  52. :end

打赏

                    支付宝                                                         微信

微信与支付宝支付

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注