Replace Strings inside Winbatch Files?

Started by vulture, November 08, 2016, 03:01:52 PM

Previous topic - Next topic

vulture

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?

td

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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade