Added write-centered.ps1

This commit is contained in:
Markus Fleschutz
2024-04-21 17:23:21 +02:00
parent 6132292e2a
commit d9f5847aed
2 changed files with 37 additions and 3 deletions

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
Writes text as headline
Writes a headline
.DESCRIPTION
This PowerShell script writes the given text as a headline.
.PARAMETER text
Specifies the headline text
Specifies the text to write
.EXAMPLE
PS> ./write-headline.ps1 "Hello World"
@ -17,8 +17,9 @@
#>
param([string]$text = "")
try {
if ($text -eq "") { $text = Read-Host "Enter the headline text" }
if ($text -eq "") { $text = Read-Host "Enter the text to write" }
Write-Host "`n* $text *" -foregroundColor green
[int]$len = $text.Length