Shutdown / Reboot your machine running Windows from within Node.JS
$ npm install --save node-shutdown-windows
const shutDownWin = require('node-shutdown-windows');
shutDownWin.logoff();
//=> logs the current user off
shutDownWin.shutdown();
//=> shuts down the whole machine instantly
shutDownWin.shutdown(20);
//=> shuts down the whole machine in 20 seconds
shutDownWin.shutdown(20, true);
//=> shuts down the whole machine in 20 seconds, forceably killing all running applications
shutDownWin.shutdown(20, false, 'The system will shut down in 20 seconds');
//=> shuts down the whole machine in 20 seconds, displaying a message until that time
shutDownWin.reboot();
//=> reboots the whole machine instantly
shutDownWin.reboot(20);
//=> reboots the whole machine in 20 seconds
shutDownWin.reboot(20, true);
//=> reboots the whole machine in 20 seconds, forceably killing all running applications
shutDownWin.reboot(20, false, 'The system will reboot in 20 seconds');
//=> reboots the whole machine in 20 seconds, displaying a message until that time
shutDownWin.abort();
//=> aborts a startup / shutdown procedure
Please also take a look at https://technet.microsoft.com/de-de/library/bb491003.aspx, since this module is just a wrapper around the Windows shutdown
command.
Logs off the current user.
timeout
{Number} Sets the timer for system logoff in secondsforce
{Boolean} Forces running applications to closemessage
{String} message Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters
Shuts down the local computer.
timeout
{Number} Sets the timer for system shutdown in secondsforce
{Boolean} Forces running applications to closemessage
{String} message Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters
Reboots after shutdown.
timeout
{Number} Sets the timer for system shutdown in secondsforce
{Boolean} Forces running applications to closemessage
{String} message Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters
Aborts shutdown / logoff / reboot.
ISC © Benedikt Reiser