File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

append a batch file

 
Muhammad Ahsan
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using websphere Ant 1.5.2 for my script

I want to edit this batch file

setlocal

set CLASSPATH=e:\progra~1\checks~1\csmm\java\rdrdispatch.jar;e:\progra~1\checks~1\csmm\java\rdrserver.jar;e:\progra~1\checks~1\csmm\java\csmutils.jar;%CLASSPATH%
java -DCSMETRICS_PROPERTIES=e:\\progra~1\\checks~1\\csmm\\java\\rdragent.properties com.checksol.metrics.server.CollectorServer rdrdbsecurity.dat

I want to put

set PATH=C:\Progra~1\WebSph~1\AppSer~1\java\jre\bin\;%PATH%

between setlocal and SET CLASSPATH

I try to use <concat> and echo tags but i don,t know exactly how to do that.

Saad
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying you want to use ant to edit a batch file with these contents:


setlocal

set CLASSPATH=e:\progra~1\checks~1\csmm\java\rdrdispatch.jar;e:\progra~1\checks~1\csmm\java\rdrserver.jar;e:\progra~1\checks~1\csmm\java\csmutils.jar;%CLASSPATH%
java -DCSMETRICS_PROPERTIES=e:\\progra~1\\checks~1\\csmm\\java\\rdragent.properties com.checksol.metrics.server.CollectorServer rdrdbsecurity.dat



and the edit you want to do it to insert a line between the two existing lines?

Why do you want to do this? You only need the PATH in some versions of the batch file?
 
Muhammad Ahsan
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on the Automation of a big system , the system consist of
lot of jacl scripts, batch files and Ant files. Instead of using perl for
text processing, I choose Ant , since we are already using ant for automating a build.

Saad
 
Muhammad Ahsan
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only need the PATH in some versions of the batch file?

What do you mean by that , please explain with an example ! I will really apprecaite that

thanks
Saad
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to confuse you. I was just trying to figure out why you needed to use ant to put a path line in the batch file. The example is so simple I'm thinking if you need it there just put it there. Now if you need different values there for different environments I can see how ant can help with filters/tokens. Or maybe you need that path in LOTS of places and you only want to have to change it in one place when necessary.

Ant uses a token separator as @, put values in text files that you want replaced using the separator and a token such as "SOME_PATH":

file needs path:
@SOME_PATH@

properties file or build file defines replacement values
SOME_PATH=...put info here...


see ant manual,
e.g., Replace Task or Copy Task.

This example is from a build file that I inherited, just to show you're not limited to replacing a simple property value:

From copy task info in ant manual:

Copy a set of files to a directory, replacing @TITLE@ with Foo Bar in all files.


I hope that points you in the right direction.
[ February 25, 2005: Message edited by: Carol Enderlin ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic