Created
December 21, 2019 11:46
-
-
Save fatihyildizhan/a32591c38a35aafb55236f41042474b8 to your computer and use it in GitHub Desktop.
powershell-loop.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while($true) | |
{ | |
Sleep 20 | |
$wshell = New-Object -ComObject wscript.shell; | |
$wshell.AppActivate('C:\WINDOWS\system32\cmd.exe') | |
Sleep 1 | |
$wshell.SendKeys('s') | |
$promptStringStart = (Get-Date).ToLongDateString() +" - "+ (Get-Date).ToLongTimeString() + " running... " | |
Write-Host $promptStringStart -NoNewLine -ForegroundColor Green | |
Write-Host $promptStringEnd -NoNewLine -ForegroundColor Green | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment