In the previous recipe, we saw how to call PowerShell scripts from outside of the IDE. We gave PowerShell the path and explicitly mentioned that we would like it to run the script, by using a call operator.
This way is ideal if you would just like the script to perform its task and not leave anything behind, such as variable values. However, there are situations where we would like to run a script and, say, retain values of the variables we declared and assigned in them or use the functions we declared in them.
In such situations where we would like the functions, variables, and even aliases retained in the current session, we use dot-sourcing.