最後更新: 2021-03-19








  • /r          # 將電腦關機並重啟
  • /s          # 將電腦關機
  • /f           # Force running applications to close without forewarning users.
  • /a          # 中止系統關機/重啟
  • /t n        # 在 n 秒後關機. 預設 30 秒後
  • /c "s"     # Comment

Exampe: schedule reboot:

名稱 reboot system (one time)

程式: C:\Windows\System32\shutdown.exe

引數: /r /t 60

設定時間: "觸發程序"

 * 不論使用者登入與否均執行

 * 以最高權限執行 (bypass UAC(User Account Control)保護)

Exampe: UPS.cmd

C:\Windows\System32\shutdown.exe /s /c UPS /t 3


Daily Reboot


Using "task scheduler" to daily reboot

Win+R > taskschd.msc > Right-click "New Folder: MyTasks"

> Right-click "Create Task..." >

Tab1: General

  • Name: Daily Reboot
  • Run whether user is logged on or now

Tab2: Triggers


  • Settings: Daily

Tab3: Actions


  • Program/script: shutdown
  • Add arguments: /r /c "Daily scheduled reboot"
  • Start in: C:\Windows\System32

Check: Event log

Win+R > eventvwr >

系統(Source: USER32, ID: 1074,  註解: Daily scheduled reboot)

30 秒後

Source: Kernel-Power, ID: 109



Remote shutdown Windows


On Remote Windows

1. Start “Remote Registry” service (RemoteRegistry)

2. Firewall allow "Windows Management Instrumentation" (WMI) # 445/TCP

Test on Windows

Shutdown by GUI

# "/i" Display "Remote Shutdown Dialog"

shutdown /i

Shutdown by CLI

  • /r = reboot
  • /s = shutdown

shutdown /r /m \\ /t 0 /c "test remote reboot" Access is denied.(5)

net use \\\IPC$ mypass /USER:user

The command completed successfully.

Shutdown by Tools - Sysinternals

PsShutdown v2.52


  • Client: Windows Vista and higher.
  • Server: Windows Server 2008 and higher.


  • -u     Specifies optional user name for login to remote computer.
  • -p     Specifies optional password for user name.
  • -k     Poweroff the computer.
  • -r     Reboot after shutdown.
  • -t     Specifies the countdown in seconds until the shutdown (default: 20 seconds)


# msg: " is scheduled to reboot in 00:00:20."

psshutdown.exe -u MyUser -p MyPass -r \\

# 立即 reboot

psshutdown.exe -u MyUser -p MyPass -t 0 -r \\

On Remote Windows

Event ID 1074

程序 wininit.exe (s.s.s.s) 已代表使用者 TIM-PC2\admin,啟動電腦 TIM-PC2 的 重新啟

Shutown from Linux

# "net" tool from the Samba package

apt-get install samba-common    # V 4.9.5

net rpc shutdown -t 0 -U user%pass -I

Shutdown of remote machine succeeded





shutdown [OPTION]...  TIME [MESSAGE]

shutdown  time [warning message]

shutdown -c    <--- Cancels a running shutdown.


shutdown 22:00 &      <-- 22:00 時 shutdown
shutdown +3 &           <--  3 min 後 shutdown
shutdown now            <-- 現在就 shutdown

If no time argument is specified, "+1" is implied.


  • -r                # reboot
  • -h               # either halted or powered off       // halt 與 poweroff 是有所不同!!
  • -H               # halted
  • -P               # powered off
  • -k               # Only  send  out the warning messages
  • -t time        # 預設值為 30

force reboot

reboot -f -n

-n    Don't sync before reboot or halt. Note that the kernel and storage drivers may still sync.


halt, poweroff, shutdown



terminates all processes and shuts down the cpu.

-n       # Don't sync before reboot or halt.


有時 halt 唔到的其中一個原因係 sync 唔到 (USB Backup Disk 不見了)


exactly like halt, but it also turns off the unit itself (lights and everything on a PC).

It sends an ACPI command to the board, then to the PSU, to cut the power.


like poweroff, but it also runs the shutdown scripts.


Force Reboot (sysrq-trigger)


當 reboot -f 唔 work 時可以用呢招

1.  enable sysrq-trigger

echo 1 > /proc/sys/kernel/sysrq

2. reboot

# b => 叫 kernel 立即 reboot !!

# o => 關機

echo b > /proc/sysrq-trigger