Scripts

View saved

Write a script file

Save as hello.ps1.

param(
  [string]$Name = "world"
)
Write-Output "Hello, $Name"

Run it

Use a path. From the current folder on Windows PowerShell:

.\hello.ps1 -Name Ada

Dot-sourcing

Dot-source loads functions into your current session.

. .\tools.ps1

Comment-based help

Add a help block so Get-Help .\hello.ps1 works for your own scripts.

<#
.SYNOPSIS
  Greets a person by name.
#>

Comments

One comment per signed-in account. Comments are saved with this page’s URL.