18 Nov 2023
Reboot Windows at a given time
For years I have installed Cygwin on basically all my machines. But with the introduction of WSL and especially WSL2 I stopped using it.
One of the Cygwin tools I used often on our servers at the office was the
Yes, Windows has a pretty decent
shutdown.exe but the major advantage of the Cygwin
shutdown is that it mimics the Linux
shutdown command, especially the possibility to add a timestamp argument.
shutdown -fri 23:30
This Cygwin command will forcefully reboot the machine and install the pending updates at 23:30.
The program will calculate the number of seconds between the moment of invocation and the requested time and pass that to the
InitiateShutdown() Win32 API.
Being a system administrator, I miss this functionality every month. When you need to install the regular Windows updates on a number of servers, you want to reboot them at a moment it has the least impact for the users. And you don’t want to calculate that number of seconds.
And another minor disadvantage of
shutdown.exe is that when you use the wrong command line options you could shutdown the machine instead of rebooting it.
To solve these two things, the timestamp and the accidentally shutdown instead of reboot, I decided to create a new tool to solve this problem. I have maintained the sources of Cygwin shutdown for some time, so I took that as an inspiration for this new tool.
The tool is named
The homepage is here and the sources can be found at GitHub.
Since some of the code of the Cygwin shutdown has been reused, I will obviously release this tool with the GPL2 license as well.
It works, but the command line parsing is not robust enough to call the tool production ready. Therefore there is no official release yet. Since I know these limitations, I use it on our production servers.
If you want to use it at this moment you need to build it yourself. For the project I use Visual Studio, so you need that to build it.
This command line tool reboots you machine at a given time. The tool takes just one argument, a timestamp when the computer needs to reboot.
now (case insensitive) means just that, reboot immediately.
# Reboot immediately RebootAt now
A timestamp means to reboot at the first time this will occur. The timestamp has to be in 24-hours notation.
# Reboot today at 23:30 RebootAt 23:30 # Reboot tomorrow at 2:00 RebootAt 2:00
An argument starting with
+ means the number following is in minutes.
# Reboot in 60 minutes RebootAt +60