Windows 7 Looking for a bat file command...

Discussion in 'Programming and Scripting' started by WinJake516, Mar 30, 2013.

  1. WinJake516

    WinJake516 New Member

    Joined:
    Mar 30, 2013
    Messages:
    5
    Likes Received:
    0
    I would love to know if there is a batch file command, or set of them, etc. to have the batch file input a command into another command prompt already opened. Specifically, I mean having it use the 'kickall' command on a minecraft server's command prompt. I would prefer something that is in windows 7, not another program like autohotkeys. I'm not a bat file expert, but I am pretty good. Thanks in advance.
     
  2. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    You could do this with vbscript easily.. the following example uses a new notepad document for testing. Replace the title with your Minecraft server window title, and it should work:

    Set oShell = CreateObject("WScript.Shell")
    oShell.AppActivate "Untitled - Notepad"
    oShell.SendKeys "kickall~"

    Save it as kickall.vbs and you can call it from a batch script easily as well.
     
  3. WinJake516

    WinJake516 New Member

    Joined:
    Mar 30, 2013
    Messages:
    5
    Likes Received:
    0
    Thanks i'll test this and see what happens
     
  4. WinJake516

    WinJake516 New Member

    Joined:
    Mar 30, 2013
    Messages:
    5
    Likes Received:
    0
    It works great, but can you make it input into two windows of the same name (command prompts)? Or can I make one window name change, like a line in the batch file, or just anything that doesn't use a downloaded program. What my file does is start, then the next file, but the second one receives input, unless i select the first one manually, and it doesn't need it.
     
  5. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    You're looking for the Title command:

    title Window1, will change the active command prompt window title to "Window1"
     
  6. WinJake516

    WinJake516 New Member

    Joined:
    Mar 30, 2013
    Messages:
    5
    Likes Received:
    0
    Thank you so much. This will make what i'm working on so much better and easier.
     
  7. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    No problem, if you have any more questions just start a new thread! :)
     

Share This Page

Loading...