How to i make a .bat that targets a program and types in a text box

后端 未结 3 1422
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 05:48

I have no idea where to start on this one. I have seen answers that are like this but I don\'t know how to format them for what I want. I just need to target the minecraft serv

3条回答
  •  死守一世寂寞
    2021-01-26 06:36

    This is not possible using a batch file alone. There are two main ways to get input to another program in the system (in this case, java.exe):

    1. Get your program to listen for a special signal. There are several administrative plugins for Minecraft which will run in the Java process and will do what you need.
    2. Spoof user input to the program. In the case of a console app, you would probably use a SendKeys() based solution. See How to send input to the console as if the user is typing for some examples.

    In the case of Minecraft, I think the first solution is going to be significantly easier, because the modding community has already supplied a number of solutions to this exact problem. @Frxstrem recommended mcrcon, which I suppose is as good a solution as any.

提交回复
热议问题