ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alec Fernandez" <Alec.Fernan...@sas.com>
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;"/>
  </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:isayed@avaya.com] 
Sent: Wednesday, July 18, 2007 9:07 AM
To: user@ant.apache.org
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message