![shutdown timer command windows 10 shutdown timer command windows 10](https://howpchub.com/wp-content/uploads/2020/05/20200520064805.png)
The below is in PowerShell, but you can write a batch file to do the same. If you need to determine if Windows has schedule a shutdown (as it does automatically after some Windows Updates) then there is a registry entry that is set which you can query. The Above solution will detect if a shutdown has been scheduled via the shutdown.exe command using the /t argument. Set /p choice=Shutdown in how many minutes?ĮDIT - I am revisiting this answer as I have more info to add.
#Shutdown timer command windows 10 code#
Here is a copy of the code I wrote for a simple auto shutdown script, it toggles between cancelling and starting a scheduled shutdown. Much better I think than freaking out a user by scheduling a shutdown. If no shutdown is in progress it will throw an error (Unable to abort the system shutdown because no shutdown was in progress.(1116)). Rather than schedule a shutdown, just try to abort it. I was too lazy to do this in a batch file, I know it is possible though. If the scheduled shutdown is more recent than either the most recent cancellation or shutdown then there is one in progress.ġ075 for a canceled scheduled shutdown, under Windows Logs/System One idea is to query the event viewer for the most recent system shutdown, the most recent scheduled shutdown, and the most recent cancellation of a scheduled shutdown. The event viewer can tell you that a shutdown has been scheduled, but not WHEN it was scheduled. I can think of two workarounds for our problem. I have the same problem, I searched all over, but did not find anything useful.Įventually I just started messing around with different things I could think of.