1.

Solve : Can please help on Telnet Batch file?

Answer»

Hi,

Can someone help me on my Telnet batch FILE? Basically what my current batch file do is telnet to a specific IP and save a screenshot of it automatically. Now what I want to do is create a text file then save all the IP and ports on it, then run a batch script to run telnet and get all the IP's and ports on the said text file. Would this be possible? Any help would be appreciate. Thanks a lot.

Regards,
MykelWhat is this for and how are you saving a screen capture? It would also help if you could post your code.Hi Lemonilla,

I USE this batch file for testing on every router I install on the client site. There are a lot of IP's and ports needed to be tested once router is up and running. For me to do it, I need to edit and PASTE each IP on each line of my batch script.


Telnet.bat

@echo off


Start "" "C:\telnet test\Captured screen"
TIMEOUT 3

start "" "C:\Windows\System32\Telnet.exe" x.x.x.x yyyy
start nircmd.exe cmdwait 5000 savescreenshotwin "C:\telnet test\Captured screen\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
TIMEOUT 7
nircmd.exe closeprocess Telnet.exe

start "" "C:\Windows\System32\Telnet.exe" x.x.x.x yyyy
start nircmd.exe cmdwait 5000 savescreenshotwin "C:\telnet test\Captured screen\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
TIMEOUT 7
nircmd.exe closeprocess Telnet.exe


x.x.x.x = server IP
yyyy = ports

As you can see on the script, I need to key-in the IP's and ports (x.x.x.x yyyy). You say you want the IP list in a text file, but you are saving PNG files. Do you intend to do an OCR of the PNG files?

I think I misunderstood where the ip:ports were coming from.I am assuming that your text file CALLED iplist.txt is a list of IP:port addresses like so: 111.222.333.444:1024
one IP:port PER line.

This batch file will then create the images:


Code: [Select]@echo off
Start "" "C:\telnet test\Captured screen"
TIMEOUT 3

for /f "delims=" %%a in (iplist.txt) do (
start "" "C:\Windows\System32\Telnet.exe" %%a
start nircmd.exe cmdwait 5000 savescreenshotwin "C:\telnet test\Captured screen\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
TIMEOUT 7
nircmd.exe closeprocess Telnet.exe
)



Discussion

No Comment Found