This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Appending Text to AutoExce.bat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Appending Text to AutoExce.bat" Watch "Appending Text to AutoExce.bat" New topic
Author

Appending Text to AutoExce.bat

Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191
Hi all ,
I am trying to append some text to autoexec.bat.
First i tried using String buffer .Taking file data into
buffer by opening inputstream and then appending some desired
text to buffer and again writing to autoexec.bat .But it is
dangerous can any one tell me what to do.
Matt Siegel
Ranch Hand

Joined: Jul 18, 2000
Posts: 55
It's pretty easy. Just create a java.io.FileWriter that points to your autoexec.bat file with the append boolean option turned on.

Here's the API for FileWriter:
http://java.sun.com/j2se/1.3/docs/api/java/io/FileWriter.html
HTH!
Matt
[This message has been edited by Matt Siegel (edited April 18, 2001).]
[This message has been edited by Matt Siegel (edited April 18, 2001).]
Awais Bajwa
Ranch Hand

Joined: Jan 16, 2001
Posts: 191
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Appending Text to AutoExce.bat