Skip to content

Instantly share code, notes, and snippets.

@fatihyildizhan
Created December 21, 2019 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatihyildizhan/a32591c38a35aafb55236f41042474b8 to your computer and use it in GitHub Desktop.
Save fatihyildizhan/a32591c38a35aafb55236f41042474b8 to your computer and use it in GitHub Desktop.
powershell-loop.ps1
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