Update simulate-typewriter.ps1

This commit is contained in:
Markus Fleschutz 2020-12-14 09:01:30 +01:00 committed by GitHub
parent 00085eb531
commit 57defe3ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,12 +11,13 @@ if ($message -eq "" ) {
$message = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n"
}
$Speed = 250
$Random = New-Object System.Random
$message -split '' |
ForEach-Object {
Write-Host $_ -nonew
Start-Sleep -milliseconds $(1 + $Random.Next(250))
Write-Host -nonewline $_
Start-Sleep -milliseconds $(1 + $Random.Next($Speed))
}
exit 0