Some time ago I was looking for and couldn’t find a way to have scripted telnet sessions for someone I know who works in air conditioning that said he could really use one. Now that I have a solution id like to share it…someone might need it someday who knows.

An easy way to do this is in notepad.

Write all the commands down as if it were a batch file and be sure to add a new line at the end to execute the last command. Select all, copy and paste it right into the telnet session. If you running 2k you can do this by simply right clicking on the DOS window after coping from notepad. The buffer will enter and execute each command in turn. The XP command window opens an options menu when right clicked so just select paste. (this is the feature I hate most about XP)

Save it with a descriptive name if you think your might need it in the future.

If you’ve flipped out and want to use telnet as your mail client for some reason or check for open relays this can save allot of time

I know everyone’s going to say telnet this and telnet that, but the reason that im passing this on to those who aren’t aware of it is…. This can be done with any command line program that doesn’t have a gui.

If I have to make a change to all the computers on the network. I use a for loop, psexec and a list of computers (FOR /f “tokens=1” %X in (allcomps.txt) do psexec %X –s cmd). Copy the commands once (last command being exit followed by a new line) and just right-click on the dos window every time a shell opens. Great for changing .ini files or copying a new shortcut to everyone’s desktop.

April 17th, 2005, 06:08 PM

sec_ware

Hi

Thanks for sharing this trick. In this context, you could also try to use a WScript-file,
by making use of SendKeys[1], if scripting is allowed.

You can automatically connect to as many hosts as you wish and perform what you
want to do without any further interaction.