PowerShell: Load a Script
Run a script in its own scope
# run script with full path ~/temp/myscript.ps1
if scriptPath is a file name in current dir, you need to put ./
in front.
# run script in current dir ./myscript.ps1
Run a script in current session scope (Dot sourcing operator)
this loads the script into current session, meaning, all variable and function are importorted into the current session.
. scriptPath
. ./myscript.ps1
PowerShell. Profile and Script
- PowerShell: Open File by Default App
- PowerShell: Launch App, Start Process
- PowerShell: Load a Script
- PowerShell: Eval Variable, String, ScriptBlock
- PowerShell: Run PowerShell from cmd.exe via STDIN
- PowerShell: Profile (init file)
- PowerShell: Manage PowerShell Profiles
- PowerShell: Create a Script
- PowerShell: File Name Extension
- PowerShell: Get Current Script Path