WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: vulture on November 08, 2016, 03:01:52 PM

Title: Replace Strings inside Winbatch Files?
Post by: vulture on November 08, 2016, 03:01:52 PM
Hi there. We have an environment that's heavily scripted using Winbatch. There are a lot of pointers to files that were previously using the old Access .mdb file format. We're going to be changing over to the new .accdb format soon. Every Winbatch job calls a specific job that sets variables. Is there any way to set a variable inside that first called job that replaces references to the .mdb part of target files with .accdb?
Title: Re: Replace Strings inside Winbatch Files?
Post by: td on November 08, 2016, 05:30:34 PM
Since we haven't seen your scripts it is impossible tell you if such a variable exists.  You can set variables in a caller script and they will be visible in the callee. But that is not exactly what you are asking.  Basically, the scripts would need to have been written such  that the Access file's name/path/extension is placed in a caller variable or passed directly to the callee as a parameter for  a solution to work without some callee editing. 

If the above isn't possible then why not just fire up an editor with good multi-file search and replace functionality?  Or you can always write a WinBatch script to make whatever changes you deem appropriate.   There is always the open source gawk utility or perhaps some other pattern matching utility, if you happen have a little Unix/Linux knowledge or want to learn something new.

We use multiple WinBatch scripts to edit many source code files for each WinBatch release.  These scripts perform tasks like version string changes, modifying version related native code, and changing numerous copyright dates.  In fact, the entire process of building each release is almost completely automated using a series of WinBatch scripts.