通过.bat在已打开的CMD中插入命令 [英] Insert command in already open CMD through a .bat
问题描述
我编码了一个网站,我的朋友可以通过PHP启动和关闭他们的Minecraft服务器。要停止他们的服务器,.bat文件会杀死进程,但通常Minecraft服务器将使用停止命令停止。 Minecraft服务器在CMD中运行,因此我的问题是:
是否可以从已启动的.bat命令发送命令到一个单独的已打开的CMD已经打开的CMD停止服务器?
您可以
I coded a website where my friends can start and close their Minecraft server over PHP. To stop their server, a .bat file kills the process, but normally Minecraft servers will be stopped with the "Stop" command. The Minecraft server is running in a CMD and so my question is:
Is it possible to send a command from a started .bat to a separate, already open CMD so that the already open CMD stop the Server?
You can send keys to the console - but eventually you'll need to know the name of the command prompt window. Check the ready to use sendKeys.bat :
call sendKeys.bat "command prompt" "stop{ENTER}"
in case the title is just command prompt
- it could be different so you need to check this.
Default title:
这篇关于通过.bat在已打开的CMD中插入命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!