spliting the passed arguments
Posted: 30 Nov 2009 06:36
Hello There,
My requirement is, the muliple arguments (JVM) that is passed to the batch file with double quotes should be passed to the JVM, when invoking the main Java file.
For example:
if i call my batch file like:
mybat.bat -vm "-Xms12m -Xmx1024m -esa"
Then the above three arguments should be passed to the Java VM.
But when I did the simple thing (Get the argument remove quote and pass it to VM) I got the following error.
"-Xmx1024m was unexpected at this time"
The Batch file looks like this
My requirement is, the muliple arguments (JVM) that is passed to the batch file with double quotes should be passed to the JVM, when invoking the main Java file.
For example:
if i call my batch file like:
mybat.bat -vm "-Xms12m -Xmx1024m -esa"
Then the above three arguments should be passed to the Java VM.
But when I did the simple thing (Get the argument remove quote and pass it to VM) I got the following error.
"-Xmx1024m was unexpected at this time"
The Batch file looks like this
if "%1" == "-vm" goto %1
.........
.......
:-vm
shift
set VMARGS=%~1
........
.......
java %VMARGS% MyProg
........