I’m starting to create a shared_variables.ps1 file where I want to store general variables that I will use in other scripts.
Then on the other scripts I just call that file and it imports all the variables to it.
I just want an idea of how to do it on PowerShell… my friend did it on Bash and it worked nice.
You could also dot-source it. That said, this is kind of a horrible practice. PowerShell isn’t Bash, and what you’re doing is loading up the global scope (which isn’t even a concept in Bash) and setting up plenty of potential conflicts. Applying Bash-style techniques in PowerShell is just going to make it harder to use PowerShell the way it was designed.