Saving The Output From A Telnet Session

“telnet “IP Address” -f “file location”      E.G.  telnet  192.168.1.1   -f   c:\router_cfg.txt

Telnet Session

 

 

 

 

 

 

 

Open a Command Window from within Windows and “tail” the session by using the argument -f with the telnet command.  This is a easy way to grab a Show Run, Show Version, and Capture Debugging messages from within the telnet session.   This is much easier than trying to copy and paste the output into Notepad from within the command window.  The scrollback within command.exe is not usually long enough for large Cisco router,firewall, or switch configurations.  This way you can simply open a command window, telnet to your device and get your Show commands and exit knowing that all the output will be stored in the text file you specified.

 

Comments

  1. That was indeed much helpful ! I did knew that I could capture the telnet output to file but I was not sure what the command format was . Yeah , it is much easier than copy pasting the whole thing to notepad . Thanks for sharing !

    • Absolutely great.

      I needed to transfer a text file (some source code) and this worked perfectly. I just used “cat” to send the file to stdout and I was done.

      thanks a ton.

  2. Hello!

    How can use use -f command and save with unique file name such as dd-mm-yy_cfg.txt?

    Thanks!

    • Andrey-

      If you are wanting to have it automatically save the date/time in the filename, I am not sure how to do that without scripting it somehow. Otherwise, you can replace the “dd-mm-yy_cfg”.txt with anything you want it to be, though you will have to type it in manually. Hope that clarifies things, thanks.

  3. Adam,

    Thanks for reply. It’s been hard to find answers for some reason. Here is my problem. I do following:

    telnet xxx.xx.xxx.xxx -f filename.txt

    This works great, but I have vb script that runs that command daily, and I want it to save as a unique name, such as today’s date.txt. I tried many ways, and cannot make it work… Something like:

    telnet xxx.xx.xxx.xxx -f mm-dd-yy.txt

    If this is not possible, maybe I should look into having script renaming it after it completes it’s operation.

    Thanks for any help!.

  4. very nice…simple and effective, thanks.

  5. Hey Adam,
    thanks for this gem – just saved me tons of time .

  6. Hi Adam,

    I have tried this utility but this not logging the session into file.

    Destination File is blank. Any guess.

    Thanks,
    Sandeep

  7. Same is happening with me as well. I am trying it but cant get any data though data is there and coming

  8. Me dull. You smart. That’s just what I neeedd.

  9. What a great tip! Works as advertised and easier than struggling w/ the MARK whatever procedure.

Leave a Reply to andy Cancel reply

*