Link to home
Start Free TrialLog in
Avatar of mmercaldi
mmercaldiFlag for Afghanistan

asked on

script to add a line to a file

I am looking for a script either batch or vb that can add a line of text to a file, but if that certain line of text is there then the script ends.

This is for windows xp and 7 computers
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

mmercaldi,

What in particular do you need to do?  An example would be helpful :)

Patrick
Avatar of Bill Prew
Bill Prew

From a BAT perspective it sounds like you could use FIND or FINDSTR to search the file for something unique to the line to be added, and then if it's not found "add" the new line.  But we'd need a bit more detail on what the file is, what the new line looks like, where it is to be added to the file, etc.

~bp
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the point...

Sorry for jumping in with speculative answer bill / patrick !