Editing hundreds of batch files?

Soldato
Joined
10 Mar 2003
Posts
6,860
Hi,

Basically I need to find and replace a common string (server name) in hundreds of batch files. This is due to a migration to a new server and the existing server still exists so I can't easily change DNS.

Is there any utility out there (even paid for utility) that will do this?

Thanks,


M.
 
Something like Notepad++/Programmers Notepad have search features that will search and replace a string in a folder of files. I've done it before will about 400+ files and it worked fine. :)
 
This might be the time to include the server name(s) from a separate file, instead of hardcoding it. That way you could have just changed a single line in one file! :)
 
Yep or use a variable like %server_name% and then set it as an environment variable, or prompt at the start of the batch file (assuming they aren't unattended).
 
Something like Notepad++/Programmers Notepad have search features that will search and replace a string in a folder of files. I've done it before will about 400+ files and it worked fine. :)

Another vote for notepad++, I used it during a really massive piece of coursework a few days ago and it never let me down.
 
either notepad++ or textpad - the only proviso I would give is textpad seems more stable - I had a file with 200,000+ lines in, did a massive f&r on it (complex regexp) which notepad++ did nicely, but left the end of the file with duplicate lines in it (replace string was shorter by 3 chars, so the last ~30,000 chars were repeated at the end of the file)

Never had that trouble with textpad, so shall be using it for large-file replacements until I have time to debug the f&r routines in np++ (or someone patches it)
 
Well the server name variable isn't really useful due to the fact that this is only temporary until I repackage them as MSI's and deploy them properly rather than the hash it is now. But thanks for the ideas though guys and the recommendations!



M.
 
Back
Top Bottom