ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <>
Subject Re: Problem with command arguments
Date Sun, 18 Jan 2004 20:48:09 GMT
michelle zaremskas wrote:

>I have an Ant task that I am writing which is invoking a Windows Command Line program.
An example of the string I am attempting to contruct is:
>pcli Put -prd:\pvcs\vm\sampledb aC:\test -o -m "My Description"  -v"My Version label"
bp/chess/server /chess/server/server.bat /chess/server/shutdown.txt
>The problem is I am having is that the command line executable will not allow a "space"
after the -m parameter and it requires double quotes around the value I am passing.  When
I attempt to construct the Command Argument using the ANT API it will either place a space
after the '-m' parameter or it will place double quotes around the string like so:  "-mMy
>Can someone provide me some guidance on how I can correctly construct this string using
the Ant API for my ANT task.
Hi Michelle,

you should construct one command line argument object per word in your 
command line.

so -m is one argument
My Description is one argument,


You probably want to call CommandLine.Argument ExecTask#createArg() for 
each argument.

For instance

ExecTask myExecTask() = new ExecTask();


CommandLine.Argument arg1 =  myExecTask.createArg();

CommandLine.Argument arg2 =  myExecTask.createArg();
arg2.setValue("My Description");


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message