Author Posts

July 4, 2017 at 1:29 pm


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.

July 4, 2017 at 1:45 pm

If you like to have it all your Powershell sessions you could put it to your personal profile or to the all users profile.

July 4, 2017 at 1:50 pm

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.

July 4, 2017 at 1:52 pm

Olaf Soyk,

Nevermind... Don Jones already gave me the answer below.
Thanks for you two!