Skip to content

Write-Typewriter

Writes text like a typewriter

param([string]$text = "Hello World, this is the PowerShell typewriter.", [int]$speed = 200) # in milliseconds

try {
	$Random = New-Object System.Random
	$text -split '' | ForEach-Object {
		Write-Host $_ -noNewline
		Start-Sleep -milliseconds $Random.Next($speed)
	}
	Write-Host ""
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the text to write (sample text by default)

Specifies the speed (200 ms by default)

An interactive directory of PowerShell scripts.