所以想打印到了文件看看错误在什么.另外求一个批处理执行错误不自动关闭的方法
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem 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 and
rem limitations under the License.
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 895392 2010-01-03 14:02:31Z kkolinko $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
谢谢一楼,试过了.不行呀
因为这个批处理还要调其它批处理.
还是会一闪而过.
而且输出的日志只能输出一部分,出错那段输不出来.
请问如何把批处理的执行过程输出到了文件?(下面是tomcat的启动脚本,报错,但一闪而过窗口关闭.)
答案:2 悬赏:80 手机版
解决时间 2021-03-19 05:27
- 提问者网友:箛茗
- 2021-03-18 09:48
最佳答案
- 五星知识达人网友:封刀令
- 2021-03-18 10:35
1.在command line中运行:tomcat.bat >>log.txt 即可
注:为了说明方便,上面的脚本文件另存为【tomcat.bat】
2.你可以选择不要直接双击脚本来执行,可以通过命令行来调用脚本文件,这样就不会出现一闪而过的情况了。
希望对你有所帮助,谢谢。。
注:为了说明方便,上面的脚本文件另存为【tomcat.bat】
2.你可以选择不要直接双击脚本来执行,可以通过命令行来调用脚本文件,这样就不会出现一闪而过的情况了。
希望对你有所帮助,谢谢。。
全部回答
- 1楼网友:未来江山和你
- 2021-03-18 11:41
进入到tomcat的bin目录下 运行 catalina.bat命名时携带参数即可, 比如 catalina run, 此时 就直接在当前命名中输出了, 而不是弹出一个.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯