WinJake516

New Member
Joined
Mar 30, 2013
Messages
5
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.
 

Solution
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.

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Joined
Aug 3, 2010
Messages
1,283
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.
 

Solution

WinJake516

New Member
Joined
Mar 30, 2013
Messages
5
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.
 

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Joined
Aug 3, 2010
Messages
1,283
You're looking for the Title command:

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

WinJake516

New Member
Joined
Mar 30, 2013
Messages
5
Thank you so much. This will make what i'm working on so much better and easier.
 

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Joined
Aug 3, 2010
Messages
1,283
No problem, if you have any more questions just start a new thread! :)