Windows 7 Looking for a bat file command...

WinJake516

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

Josephur

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

WinJake516

New Member
Joined
Mar 30, 2013
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
Location
Indiana, USA
You're looking for the Title command:

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

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Joined
Aug 3, 2010
Location
Indiana, USA
No problem, if you have any more questions just start a new thread! :)
 
Top Bottom