You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by coluf <co...@hotmail.com> on 2004/02/05 05:03:44 UTC

Best means to create a Windows cmd file from ant

I wish to create a script file for Windows, that is, a .cmd file to start my java project.  

It makes sense to create the file from within ant so any changes to the class path are reflected in the script.

But what is the best way to create a Windows script file from within ant?  Using <echo> does not terminate the end-of-lines
for Windows correctly (must default for unix?).

An extract from my ant script...

   <target name="dist" depends="init, jar">
      ...
      <pathconvert targetos="windows" property="dist.libs" refid="build.classpath"/>
      <echo file="${dist.bin}/${corename}.cmd">@echo off
         setlocal
         set classpath=${jar.filename};${dist.libs}
         java ${main.class} -cp %classpath%
      </echo>


RE: Best means to create a Windows cmd file from ant

Posted by Koji Sekiguchi <ko...@bluemartini.com>.
How about using <fixcrlf> task with eol="dos" attribute
just after using <echo> task in order to fix the end of lines?

Koji

====================================
Technical Support
Blue Martini Software K.K.
Shinbashi Chuo Building 6th Floor
1-11-5 Nishi-shinbashi, Minato-ku
Tokyo 105-0003 Japan
Tel: 81-3-5521-6670
Fax: 81-3-5521-6671
www.bluemartini.co.jp


> -----Original Message-----
> From: coluf [mailto:coluf@hotmail.com]
> Sent: Thursday, February 05, 2004 1:04 PM
> To: user@ant.apache.org
> Subject: Best means to create a Windows cmd file from ant
> 
> 
> I wish to create a script file for Windows, that is, a .cmd file 
> to start my java project.  
> 
> It makes sense to create the file from within ant so any changes 
> to the class path are reflected in the script.
> 
> But what is the best way to create a Windows script file from 
> within ant?  Using <echo> does not terminate the end-of-lines
> for Windows correctly (must default for unix?).
> 
> An extract from my ant script...
> 
>    <target name="dist" depends="init, jar">
>       ...
>       <pathconvert targetos="windows" property="dist.libs" 
> refid="build.classpath"/>
>       <echo file="${dist.bin}/${corename}.cmd">@echo off
>          setlocal
>          set classpath=${jar.filename};${dist.libs}
>          java ${main.class} -cp %classpath%
>       </echo>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org