Do not forget that ant in written in java and
the exec argument uses Process - the Process
code is given the command line as a string, and adds
(in c) in it's own quoting characters.
Always one should play around with simple ant scripts
to try to see what will work for the <exec> call.
Remember that a lot of directories have spaces in windows
and this, combined with the multiple layers of quoting and
interpretation
(ant, Java, cmd and the other commands)
mean that things may not work as expected.
Peter
On 7/18/07, Alec Fernandez <[EMAIL PROTECTED]> wrote:
Howdy folks,
This from the exec doc:
<!-- not tested -->
<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value=""dir;cls;set;cls;"/>
</exec>
</target>
I would recommend that you read the dos "man" pages on cmd start and call, they
are quite useful. Pay close attention to the /c /k and /s options if you are passing
multiple commands and quotes are necessary.
Cmd /? Yields a wealth of info, I've found the following snippet is
particularly useful:
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
the two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
-----Original Message-----
From: Sayed, Irfan (Irfan) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 18, 2007 9:07 AM
To: [email protected]
Subject: Execution of windows command in ant's build.xml
Hi All,
Need to execute windows 'cls' command in the Ant's build.xml file.
Can somebody please help.
Regards
Irfan.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]