One caveat about transferring globals between namespaces / instances using XML format is that by default when you load the XML into the target namespace the global(s) in your XML file will be pre-killed. In other words, it's a "replace" operation rather than a "merge" one. This may be exactly what you want in many situations, but if you've been used to using other utilities to export and import globals then it's different.

To override this behaviour, add the "/mergeglobal=1" qualifier during your import, for example as the second argument (qspec) to $system.OBJ.Load(), which is of course the Load classmethod of %SYSTEM.OBJ.

See more qualifier documentation here.

Interesting question. I expect you're already aware of how we can get the value of an environmental variable thanks to the GetEnviron method of %SYSTEM.Util

USER>w $system.Util.GetEnviron("TEMP")
C:\WINDOWS\TEMP
USER>

Maybe someone else knows how you can amend one. But if it's not possible, can you improve readability in your code by concatenating the components of your $ZF argument in several stages into a local variable, then passing that variable as the argument to $ZF ?