Thursday, June 23, 2011

String Replace with Command Line

Computer > Programming > Batch Files

Many times while programming Windows batch scripts for maintenance jobs, I had the need for replacing or deleting a string from a text file.

This is not a straight-forward action in batch file, so I decided to write my own command-line executable to help me.


You can download it from the following link:

StrReplace.exe

Usage:
StrReplace input_file original_string [replacement_string]

input_file: The file to read text from

original_string: The string to search in each line for replacement

replacement_string:  The string to be inserted at places of the original_string
                     if omitted then original_string will be deleted


No comments:

Post a Comment