Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: HOW TO CREATE BATCH FILE  (Read 3224 times)

0 Members and 1 Guest are viewing this topic.

arios

  • Guest
HOW TO CREATE BATCH FILE
« on: February 10, 2008, 11:36:52 PM »
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





chsu05



    Rookie

    Re: HOW TO CREATE BATCH FILE
    « Reply #1 on: February 11, 2008, 12:09:02 PM »
    Are you trying to create a batch just to kill a process or trying to restart the server?

    Dias de verano

    • Guest
    Re: HOW TO CREATE BATCH FILE
    « Reply #2 on: February 11, 2008, 01:16:02 PM »
    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






    diablo416



      Hopeful
      Re: HOW TO CREATE BATCH FILE
      « Reply #3 on: February 12, 2008, 06:38:35 AM »
      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