How to close cmd after Programm startet

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Nils_8214
Posts: 2
Joined: 20 Nov 2021 17:32

How to close cmd after Programm startet

#1 Post by Nils_8214 » 20 Nov 2021 17:36

So i have a Batch File

Code: Select all

@echo off
set JLINK_VM_OPTIONS=
set DIR=%~dp0
"%DIR%\java" %JLINK_VM_OPTIONS% -m Test/org.openjfx.Main %*


which opens a javafx programm but the cmd is still opend how to let it close automaticly

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to close cmd after Programm startet

#2 Post by aGerman » 21 Nov 2021 05:03

You need to use the START command

Code: Select all

start "" "%DIR%\java" %JLINK_VM_OPTIONS% -m Test/org.openjfx.Main %*
The empty pair of quotes at the beginning is critical.

Steffen

Nils_8214
Posts: 2
Joined: 20 Nov 2021 17:32

Re: How to close cmd after Programm startet

#3 Post by Nils_8214 » 21 Nov 2021 05:45

still the same but now it has the openjdk icon

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to close cmd after Programm startet

#4 Post by aGerman » 21 Nov 2021 07:39

In this case it's likely the openjdk console which is still open (rather than the cmd console). I'm not familiar with openjdk. So I'm not able to give any advice here.

Steffen

penpen
Expert
Posts: 1943
Joined: 23 Jun 2013 06:15
Location: Germany

Re: How to close cmd after Programm startet

#5 Post by penpen » 21 Nov 2021 17:47

I'm not familiar with OpenJDK, but if it's similar to the JDK, then there are two executables:
One for windows ("javaw.exe") and one for the console window ("java.exe"). If you start the console version, then the console will stay open, because its streams (STDIN, STDOUT and STDERR) are connected with "System.in", "System.out" and "System.err". If you force the console to close, "java.exe" should also shut down.


penpen

Post Reply