Is there a Windows equivalent of the caffeinate utility on OS X? I want to have fairly aggressive logout settings in general, but have a dedicated program that prevents logout while it is running as a way of overriding this setting.
The caffeinate utility prevents logout as long as it is active, which is nice. caffeinate is a C program distributed by Apple. The source code to it is here .
I found a Powershell script that's roughly equivalent to it here and have been using a trivial modification of it shown below.
param($minutes = 36000)
$myshell = New-Object -com "Wscript.Shell"
for ($i = 0; $i -lt $minutes; $i++) {
Start-Sleep -Seconds 60
$myshell.sendkeys(".")
}
It sends a . keystroke to the graphical shell (and hence whatever application has focus) once a minute for 10 hours by default.
This means that you have to be vigilant when typing or else a stray . will appear once a minute, which is less than ideal.
Is there a more elegant way to write a program that disables logout, but only when it's running?