Save PuTTY output to file from command-line

command lineputty

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.

What I'm working on:

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?

Best Answer

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

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

enter image description here

enter image description here

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.

Now open CMD and write the command as below enter image description here

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