|
Answer» every time i want kill my server i need to telnet to my server, then login and also PASSWORD, then run the command to kill it. anybody can teach me how to create it in batch file??
telnet 000.000.000.000 login : root password : xxxxxxxx goxxxx .//stop .//start exit
Are you trying to create a batch just to kill a process or trying to restart the server?You will need a 3th party Telnetclient, that can be scripted. You cannot script a telnet login from the command line. This is by design (unless you can log in anonymously). You can specify a username from the command line but not a password. This is a security precaution built into the telnet client included with Windows. You have a few options. Use a different telnet client, use an automation scripting tool such as KixStart or AutoIt,
or try the Telnet Scripting Tool.
http://dl.winsite.com/files/523/ar2/win95/netutil/tst10.zip
you dont need a 3rd party telnetclient , you can use wsh.sendkeys instead.
Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "telnet.exe", 1 WScript.Sleep 500 For i = 1 To 1 WshShell.SendKeys "TEST" WshShell.SendKeys "{ENTER}" Next
using notepad , save it as script.vbs and all files type. double-click it , and it should SEND test and then enter to telnet. look here for other buttons you can use http://www.ss64.com/wsh/sendkeys.html
for i = 1 to 1 reffers to how many times you want it to repeat basically , 1 to 1 is 1 time 1 to 2 is 2 times ect. , if you include ANOTHER one of these make sure to add next at the bottom
For i = 1 To 100 WshShell.SendKeys "100 times" Next
|