As I first commented, this would work:
start "test" "D:\ab cd\jre\bin\javaw" -jar "path_to_my_jar"
But I would suggest change to this to remove the ambiguity (potential danger):
start "title" "D:\ab cd\jre\bin\javaw.exe" -jar "path_to_my_jar"
Also if you do this often, I would suggest you to add D:\ab cd\jre\bin\
to PATH
variable,
then afterwards you can just start "title" javaw ...
.
Path that has spaces inside need to be enclosed.
On the other hand, the things enclosed by a pair of quotes are considered as a whole.
And as Klitos Kyriacou said in the comments to double-beep's answer, the start "test"
part is optional in this case, seems superfluous, you can just "path\to\javaw.exe" -jar "path_to_my_jar"
.
However, I wouldn't suggest you to remove it. As it's not intuitive to know which exe
won't wait and which will, so it's actually better to keep using start
to control it intuitively.
start ""
won't pause current batch/cmd to wait, but start /wait
will.
Related question:
How does the command prompt know when to wait for exit?