简体   繁体   English

使用.bat打开过程后关闭Cmd窗口

[英]Cmd window to close after opening process with .bat

I'm new with batch file and the code I'm using I had to find but it always opens cmd but doesn't close it after the program is open. 我是批处理文件的新手,必须使用找到的代码,但它始终会打开cmd但在程序打开后不会将其关闭。 I'm aware that it doesn't close because it's a window process and cmd doesn't close until after the window is closed. 我知道它不会关闭,因为这是一个窗口进程,而cmd直到窗口关闭后才会关闭。 I would like to to close after it opens the window. 打开窗口后,我想关闭。 Here is the code: 这是代码:

"C:\Program Files\Java\jre7\bin\javaw.exe" -Xmx1G -Xms1G -jar "Minecraft_Server.exe"

I've used many different ways close it like putting Exit at the end or putting cmd /c in front but that didn't work. 我使用了许多不同的方法来关闭它,例如将Exit放在末尾或将cmd /c放在前面,但这没有用。

Update 更新

The start command does not seem to work with multiple parameters. 启动命令似乎不适用于多个参数。 Only solution I could come up with is creating a windowless executable that handles the executing with multiple parameters. 我唯一能想到的解决方案是创建一个无窗口可执行文件,该文件处理具有多个参数的执行。


Original answer 原始答案

I've tested the following and it works because Progra~1 is the a conversion of the Program files folder in oldskool 8 character style: 我已经测试了以下内容,并且可以正常工作,因为Progra〜1是oldskool 8字符样式的Program files文件夹的转换:

start c:\Progra~1\Intern~1\iexplore.exe -new -k "http://www.google.com/"

I cannot verify this because I do not have java, but it should work: 我无法验证这一点,因为我没有Java,但是它应该可以工作:

start C:\Program~1\Java\jre7\bin\javaw.exe -Xmx1G -Xms1G -jar "Minecraft_Server.exe"

However if more folders start with Progra then it could also be Progra~2 , Progra~3 etc. You would have to try what works. 但是,如果更多文件夹以Progra开头,那么它也可能是Progra~2Progra~3等。您必须尝试有效的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM