11 PARAMETERS AND ARGUMENTS

In the previous chapter, I demonstrated how a bat file can call both internal routines and other bat files, but I didn’t discuss how to pass data back and forth between the calling and called logic. By default, all variables set in the calling code are exposed to the called code, and vice versa. If the code is closely coupled, there’s technically no need to pass arguments and accept parameters, but to make that work, both sets of code must agree on and use the same set of variables.

That’s adequate if you’re creating a second bat file simply to break up a large project and the called bat file will never be called ...

Get The Book of Batch Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.