@cyysu
2017-10-12T10:18:38.000000Z
字数 2156
阅读 941
- 时间:2017年10月12日
- 作者:Kali
- 邮箱:cyysu.github.io@gmail.com/2869905223@qq.com/微信lwyx1413
- 版本:4.0
- 描述:批处理实战基础篇三,主要讲解tomcat下启动脚本,本文主要讲解version.bat这个脚本
Bat系列教程
其目录下面的脚本文件如下,有些重复的内容,这里不做过多介绍,有遇到什么不会的内容可以查看Bat系列教程
下面我们一一来分析其里面的内容,为了避免文本过长,每个文件单独一篇文章讲解。
# version.bat@echo offrem Licensed to the Apache Software Foundation (ASF) under one or morerem contributor license agreements. See the NOTICE file distributed withrem this work for additional information regarding copyright ownership.rem The ASF licenses this file to You under the Apache License, Version 2.0rem (the "License"); you may not use this file except in compliance withrem the License. You may obtain a copy of the License atremrem http://www.apache.org/licenses/LICENSE-2.0remrem Unless required by applicable law or agreed to in writing, softwarerem distributed under the License is distributed on an "AS IS" BASIS,rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.rem See the License for the specific language governing permissions andrem limitations under the License.rem ---------------------------------------------------------------------------rem Version script for the CATALINA Serverrem ---------------------------------------------------------------------------setlocalrem Guess CATALINA_HOME if not defined:: 设置CURRENT_DIR为当前目录 %cd%指的是当前进入的目录set "CURRENT_DIR=%cd%":: 如果CATALINA_HOME已经设置了 就跳转gotHome标签if not "%CATALINA_HOME%" == "" goto gotHome:: 如果没有的话,那么就设置为当前目录set "CATALINA_HOME=%CURRENT_DIR%":: 如果存在catalina.bat,就跳转okHome标签if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHomecd ..set "CATALINA_HOME=%cd%"cd "%CURRENT_DIR%":gotHomeif exist "%CATALINA_HOME%\bin\catalina.bat" goto okHomeecho The CATALINA_HOME environment variable is not defined correctlyecho This environment variable is needed to run this programgoto end:okHomeset "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"rem Check that target executable existsif exist "%EXECUTABLE%" goto okExececho Cannot find "%EXECUTABLE%"echo This file is needed to run this programgoto end:okExecrem Get remaining unshifted command line arguments and save them in theset CMD_LINE_ARGS=:setArgsif ""%1""=="""" goto doneSetArgs:: 如果输入参数不为空 那么将参数进行移位操作set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1shiftgoto setArgs:doneSetArgs:: 调用其他脚本 传递的参数为 version %CMD_LINE_ARGS%call "%EXECUTABLE%" version %CMD_LINE_ARGS%:end
支付宝 微信