Windows 7 Looking for a bat file command...

#1
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
#2
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
Thanks i'll test this and see what happens
 


#4
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
#5
You're looking for the Title command:

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


#6
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
#7
No problem, if you have any more questions just start a new thread! :)
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.