如何直接输出到Windows的脚本蝙蝠一个txt文件 [英] how to direct output into a txt file in bat script in windows

查看:387
本文介绍了如何直接输出到Windows的脚本蝙蝠一个txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中,让说我要启动Tomcat,并希望将所有的控制台登录到一个文本文件,我可以做写一个bash脚本:

in linux, let say i want to start tomcat, and want to direct all the console log into a text file, i can do write a bash script:

./ startup.sh> output.txt的

./startup.sh > output.txt

但在Windows,可使用的.bat脚本,我们做类似的东西。

but in windows, can we do the similar stuff using .bat script.

我怎么能写这个剧本的蝙蝠???

how can i write this bat script???

(我知道正确的方式应该要求应用程序做日志,但应用程序不是由我写的,他们使用system.out.print打印日志,所有日志都在控制台上,但我想归档日志,万一遇到什么事情,我可以回溯)

(i know the proper way should ask the application to do the log, but the application is not written by me, they print the log using system.out.print, all the logs are in the console, but i want to archive the log, in case something happen i can back trace)

推荐答案

这正是Windows中的相同。

It's exactly the same in Windows.

ping google.com > logfile.txt

或在PowerShell中,你可以做以下显示日志到控制台以及

or in powershell you could do the following to display the log to console as well

ping google.com | tee-object -filepath C:\mylog.txt

这篇关于如何直接输出到Windows的脚本蝙蝠一个txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆