Skip to content

Instantly share code, notes, and snippets.

@rey
Last active November 13, 2023 16:49
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 rey/0d746b8aef385eb160899fd9be8dc50a to your computer and use it in GitHub Desktop.
Save rey/0d746b8aef385eb160899fd9be8dc50a to your computer and use it in GitHub Desktop.
# Powershell one-liner to prevent idle / sleep
# https://www.reddit.com/r/PowerShell/comments/ikrouy/comment/g3nd845/
1..9999|ForEach-Object {$S = New-Object -Com "Wscript.Shell"}{Sleep -S (30+$S.Sendkeys("+"))}
@rey
Copy link
Author

rey commented Nov 13, 2023

This doesn't throw an error problem:

1..9999|ForEach-Object {$S = (New-Object -Com "Wscript.Shell").Sendkeys("+"); Sleep -S (30+$S)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment