PowerShell - Random Text Generator
Wanted to try to generate a random text every so often to prevent screen locking which did not work and stumbled upon this and learned a couple of neat tricks from PowerShell. The actual solution that seems to work for preventing screen locking is here
-join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})
Then the script to write random text to a screen on an interval
Clear-Host
Echo "...Hello I randomly type things to avoid screen locking..."
while ($true)
{
$word = -join ((65..90) + (97..122) | Get-Random -Count 5 | % {[char]$_})
Write-Host $word
Start-Sleep -Seconds 2
}
Output
...Hello I randomly type things to avoid screen locking...
JoIVe
OekJi