Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute shutdown command from cygwin in Windows

Tags:

cygwin

How can I execute a Windows shutdown command (shutdown -r) from Cygwin on a Windows 2003 server machine?

like image 555
Bharath Avatar asked Feb 24 '11 12:02

Bharath


1 Answers

// windows xp
shutdown -s -f now

// windows 7
shutdown /r /t 0

It varies from windows version to version. Just do a check using shutdown --help and figure out what to use on your specific version.

And the help page as picked up from cygwin on my case (varies).

% shutdown --help
Usage: shutdown [OPTION]... time
Bring the system down.

  -f, --force      Forces the execution.
  -s, --shutdown   The system will shutdown and power off (if supported)
  -r, --reboot     The system will reboot.
  -h, --hibernate  The system will suspend to disk (if supported)
  -p, --suspend    The system will suspend to RAM (if supported)
      --help       Display this help and exit.
      --version    Output version information and exit.

`time' is either the time in seconds or `+' and the time in minutes or a
timestamp in the format `hh:mm' or the word "now" for an immediate action.

To reboot is the default if started as `reboot', to hibernate if started
as `hibernate', to suspend if started as `suspend', to shutdown otherwise.
like image 83
Frankie Avatar answered Oct 31 '22 09:10

Frankie