telnet output save it to file using .bat file

shell, telnet, windows

Solution

You could try `telnet “IP Address” -f “file location"`. Found the solution here.

Problem

telnet 10.0.0.22 3389 ( for checking rdp port ) I want to create a batch file, for checking two or three port, so i create a .bat file in that i have written ``` telnet 10.0.0.22 1158 >> C:\result\telnetresult.txt telnet 10.0.0.22 3389 >> C:\result\telnetresult.txt telnet 10.0.0.22 1159 >> C:\result\telnetresult.txt ``` but it didn't work. Can you suggest where i am doing mistake or if there is some other alternative / Workaround. I also tried to create another .bat file with the following command. Telnet set logfile c:\log.txt ``` Open 10.0.0.22 80 open 10.0.0.22 1158 open 10.0.0.22 3389 ``` but it also didn't work.

Original source