Skip to content

Write-Headline

Writes a headline

param([string]$text = "")

try {
	if ($text -eq "") { $text = Read-Host "Enter the text to write" }

	[int]$len = $text.Length
	[string]$line = "------"
	for ([int]$i = 0; $i -lt $len; $i++) { $line += "-" }
	Write-Host "`n$line`n   $text`n$line" -foregroundColor green
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the text to write

An interactive directory of PowerShell scripts.