I created a PowerShell script to set aliases for a PowerShell session. When I run the script and try the alias, I get the error saying that the alias isn't recongized. How can I use the aliases that are set by the script?
Run the script using Dot sourcing operator:
.Dot sourcing operator
Runs a script in the current scope so that any functions, aliases, and variables that the script creates are added to the current scope.
Note: The dot sourcing operator is followed by a space. Use the space to distinguish the dot from the dot (
.) symbol that represents the current directory.
In the following example, the
Sample.ps1script in the current directory is run in the current scope.