The problem is that branch.GMS does not recognize the parameters that are used in root.GMS.

One obvious solution would be to split root.GMS in two, and to use the save and restart facilities. The first part would include all the code up to the call to myscript.ps1 (call this root1.GMS), and the second part would include all the code from myscript.ps1. (call this root2.GMS).

The following PowerShell code should work then (assuming no parameters are defined in branch.GMS that are needed in root2.GMS):

However, this solution would quickly become unwieldy with several layers of nesting. Is there any other approach that would allow me to pass on the parameters defined in root1.GMS to branch.GMS without abandoning the nesting structure?

@Renger Thanks for the tip. Technically, that would be solution, but it is also error prone: if you add new parameters or variables, you could easily lose track of them. Now that I think of it, this is precisely a key advantage of the 'save' and 'restart' commands.
I have worked around the problem by implementing the solution I had discussed in my first post: I now call all GAMS scripts from a single PowerScript script. It's not very elegant, but it does work.