Last active
November 28, 2020 03:08
-
-
Save RitamChakraborty/48dfb606944ebfaa9dea5436dddfbb24 to your computer and use it in GitHub Desktop.
Stops windows computer from going to sleep. Handy for corporate machines which has automatic sleep enabled by the admin, and changing the settings doesn't work. Run the script with PowerShell ISE and enjoy.
This file contains 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
$i = 0 | |
while ($true) { | |
[System.Windows.Forms.SendKeys]::SendWait("{F5}") | |
Start-Sleep -s 60 | |
$i++; | |
$text = "" | |
if ($i -eq 1) { | |
$text = "minute has" | |
} else { | |
$text = "minutes have" | |
} | |
echo "$i $text passed" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment