PowerShell - Script
Management
List
Display scripts in Windows PowerShell's search path
Get-Command -CommandType Script
Argument
- by position
$first=$args[0]
$second=$args[1]
- by name
param([Int32]$second,[string]$first)
Run
Interactively
PowerShell .\myScript.ps1
where PowerShell - PowerShell.exe
Background
From Dos
@echo off
SET SCRIPT_PATH=%~dp0
powershell -Command "& {%SCRIPT_PATH%myScript.ps1}"
From Powershell
- Added to the Local scope
. c:\scripts.sample.ps1
- Added to the Global (Default)
c:\scripts.sample.ps1
- Not Added
& c:\scripts.sample.ps1