ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alec Fernandez" <>
Subject RE: Execution of windows command in ant's build.xml
Date Wed, 18 Jul 2007 15:45:09 GMT
Howdy folks,

This from the exec doc:

<!-- not tested -->
<target name="help">
  <exec executable="cmd">
    <arg value="/c"/>
    <arg value="&quot;dir;cls;set;cls;"/>

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) [] 
Sent: Wednesday, July 18, 2007 9:07 AM
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.

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

View raw message