永发信息网

请问如何把批处理的执行过程输出到了文件?(下面是tomcat的启动脚本,报错,但一闪而过窗口关闭.)

答案:2  悬赏:80  手机版
解决时间 2021-03-19 05:27
所以想打印到了文件看看错误在什么.另外求一个批处理执行错误不自动关闭的方法
@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

谢谢一楼,试过了.不行呀
因为这个批处理还要调其它批处理.
还是会一闪而过.
而且输出的日志只能输出一部分,出错那段输不出来.
最佳答案
1.在command line中运行:tomcat.bat >>log.txt 即可
注:为了说明方便,上面的脚本文件另存为【tomcat.bat】

2.你可以选择不要直接双击脚本来执行,可以通过命令行来调用脚本文件,这样就不会出现一闪而过的情况了。

希望对你有所帮助,谢谢。。
全部回答
进入到tomcat的bin目录下 运行 catalina.bat命名时携带参数即可, 比如 catalina run, 此时 就直接在当前命名中输出了, 而不是弹出一个.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
耳垂最下端长痣在相面学上代表什么?
骆驼圈子地址在哪,我要去那里办事
小米4屏幕摔碎了一半能触屏一半不能触屏该怎
小型电动车的电机锁长什么样,在哪个位置
康雅旅馆在什么地方啊,我要过去处理事情
我常常喝自己的尿吃自己射出的精液
老高皇冠俱乐部年费怎么收?
开个汉堡店的流程是什么?是先办理营业执照和
四川英语教育自考 能查到考籍,自考时间过期
倒位的倒位杂合体
治本地怎么去啊,有知道地址的么
哪部电影唱过欢颜这首歌
心悦会员对英魂之刃有用吗?
北奔t50开关错误什么意思
激光矫正近视好一点还是戴隐形眼镜好一点
推荐资讯
腿上烫伤疤痕半年多了用弹力套还有用吗
( )地站着 ( )地写
成都东鹏瓷砖在哪里批发 我是做瓷砖销售的
属虎,炉中火命。请问五行缺什么?
建行卡在农行取钱出钞口没出来钱卡里却少了
散装白酒多少钱一斤?质量有保证吗
老款索纳塔开到120迈发动机异响发抖是怎么回
什么品牌的颈椎枕好
做作业要小结是什么意思
传奇1.85合击 哪个组合比较猛
佳能有什么好用的镜头?我想用小痰盂拍照,主
选择合适的旋铆机需要提供什么参数
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?