mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-09 18:19:32 +02:00
Updated write-typewriter.ps1
This commit is contained in:
parent
bdc4cb1002
commit
6b2abf3103
@ -1,27 +1,27 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Writes text á la typewriter
|
Writes text like a typewriter
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script writes the given text with the typewriter effect.
|
This PowerShell script writes the given text with the typewriter effect.
|
||||||
.PARAMETER text
|
.PARAMETER text
|
||||||
Specifies the text to write
|
Specifies the text to write (sample text by default)
|
||||||
.PARAMETER speed
|
.PARAMETER speed
|
||||||
Specifies the speed (250 ms by default)
|
Specifies the speed (200 ms by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./write-typewriter "Hello World"
|
PS> ./write-typewriter.ps1 "Hello World"
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$text = "`nHello World`n-----------`n* PowerShell is powerful - fully control your computer`n* PowerShell is cross-platform - available for Linux, Mac OS and Windows`n* PowerShell is open-source and free`n* PowerShell is easy to learn`n* PowerShell is fully documented`n`nThanks for watching`nMarkus`n", [int]$speed = 200) # in milliseconds
|
param([string]$text = "Hello World, this is the PowerShell typewriter.", [int]$speed = 200) # in milliseconds
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Random = New-Object System.Random
|
$Random = New-Object System.Random
|
||||||
$text -split '' | ForEach-Object {
|
$text -split '' | ForEach-Object {
|
||||||
Write-Host -noNewline $_
|
Write-Host $_ -noNewline
|
||||||
Start-Sleep -milliseconds $(1 + $Random.Next($speed))
|
Start-Sleep -milliseconds $Random.Next($speed)
|
||||||
}
|
}
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user