从命令行将 PuTTY 输出保存到文件 [英] Save PuTTY output to file from command-line

查看:266
本文介绍了从命令行将 PuTTY 输出保存到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用命令行将 PuTTY 输出保存到文件中?我知道这很容易使用 GUI 完成,但在我的情况下,它必须自动完成.

Is there any way to save the PuTTY output to a file using the command line? I know this is easily done using the GUI but in my case it has to be done automatically.

我在做什么:

用户点击批处理文件 -> 启动 PuTTY,通过 SSH 自动连接到我的设备并运行一系列命令 -> PuTTY 应该将输出保存到文件中.

User clicks batch file -> starts PuTTY, automatically connects to my device over SSH and runs a bunch of commands -> PuTTY should save the output to a file.

最后一部分我无法工作.是否有任何命令可以执行此操作?

The last part I can't get working. Is there any command to do this?

推荐答案

这可以用 putty 来完成.考虑到提出问题的时间,答案有点晚了,但这可能会对某人有所帮助.

This can be done with putty. The answer is little late considering the time the questions was asked, however this might help someone.

在 putty 中,使用 GUI,您可以保存会话并启用日志记录选项,如下所示.

In putty, using GUI, you can save sessions with logging option on, as shown below.

输入主机名,命名会话,转到左上角的日志选项,选择所有会话,提供日志文件名和位置,返回会话选项卡,单击保存按钮.完成,您已保存会话.

Enter Host Name, Name the session, Go to Logging Option in the left top corner, select all sessions, provide log file name and location, go back to Session tab, click on the save button. Done, you have saved a session.

现在打开CMD并编写如下命令

Now open CMD and write the command as below

你已经完成了.每次调用此会话时,都会记录命令和输出.希望这会有所帮助.

You are done. Every time this session is invoked, the commands and output will be logged. Hope this helps.

这篇关于从命令行将 PuTTY 输出保存到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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