Actually the process is:
- cmd starts bat -> bat starts java -> java runs jar.
So you do not start cmd.exe separately, it's already up and running.
If you want to change directory to reflect the location of the jar file then use the CD command.
@CD /D "L:\ocation\Of\Jar File"
@"P:\ath\To\java.exe" -jar "nameofjarfile.jar"
Or just provide the path to the jar file directly:
@"P:\ath\To\java.exe" -jar "L:\ocation\Of\Jar File\nameofjarfile.jar"
If you wanted to open a separate cmd.exe window, and leave it open, then use the START command:
@Start "" /D "L:\ocation\Of\Jar File" %SystemRoot%\System32\cmd.exe /D /K ""P:\ath\To\java.exe" -jar "nameofjarfile.jar""
To learn how to use the CD command, open a Command Prompt window, type cd /?, and press ENTER. And similarly for the START command, type start /?, and press ENTER.
start cmd.exe /k "java -jar pathname". I'll leave it to you to correctly apply the path(s) (or usestart's/dswitch).