1

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. 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. 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.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

1

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:

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:

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.

Silvermind
  • 5,791
  • 2
  • 24
  • 44
  • thank you that worked i used start a couple of times but it would always says something like "Windows could not find -Xmx1G be sure you spelled it right" but thank you again – skeletonchoji Mar 26 '12 at 22:57
  • 1
    I don't think this answer would work. "start" will choke on the multi parameters. – djangofan Feb 13 '13 at 21:21
  • @djangofan You're right, I don't know why it worked then, but my only guess would be that google.com was my default browser page. – Silvermind Feb 14 '13 at 12:37