In my main script, I will first call the init function to initiate many of the variables that I expected to be used in the script. One way is to use variables whose name is $script:var1 , which are a script-level variable. But so ugly, and I would like to use the standard variable name, so I need a mechanism for the source of the function, like the source of the file.
At the source of the file, all variables in this file are available in the calling script.
powershell
Daniel Wu
source share