CMD Simulator
System Informationshutdown

SHUTDOWN Command Guide - Shut Down, Restart, or Log Off Windows

Learn how to use the SHUTDOWN command to shut down, restart, or log off Windows from the command line. Includes /s, /r, /l, /t, /a options, remote shutdown, and scripting examples.

Rojan Acharya·
Share

The SHUTDOWN command is a Windows Command Prompt utility that shuts down, restarts, or logs off the local or remote computer. Use SHUTDOWN /s to shut down, SHUTDOWN /r to restart, SHUTDOWN /l to log off, or SHUTDOWN /a to abort a pending shutdown. Essential for system administration, remote management, and automated maintenance scripts.

Whether you're performing remote server maintenance, scheduling reboots after updates, creating deployment scripts that restart machines, or allowing users to cancel an accidental shutdown, the SHUTDOWN command provides full control over system power state from the command line. IT professionals rely on it for batch restarts, scheduled maintenance windows, and emergency shutdown procedures.

This comprehensive guide covers SHUTDOWN syntax, all major options (/s, /r, /l, /t, /a), remote shutdown, practical examples, troubleshooting tips, related commands, and frequently asked questions. By the end, you'll confidently manage system shutdown and restart operations from CMD and scripts.

What Is the SHUTDOWN Command?

The SHUTDOWN command:

  • Shuts down – Powers off the computer (/s)
  • Restarts – Reboots the computer (/r)
  • Logs off – Ends the current user session (/l)
  • Aborts – Cancels a pending shutdown (/a)
  • Supports delay – /t seconds to wait before acting (default 60 for /s and /r)
  • Remote capable – Can target other computers with /m \computername

SHUTDOWN requires administrative privileges for local shutdown/restart. Log off (/l) works with standard user rights. Available in Windows Vista and later, including Windows 10, 11, and Windows Server.

SHUTDOWN Command Syntax

SHUTDOWN [/s | /r | /l] [/t seconds] [/a] [/m \\computername] [/c "comment"] [/d [p|u:]xx:yy]

Key Parameters

ParameterDescription
/sShut down the computer
/rRestart the computer
/lLog off (no shutdown)
/t secondsDelay before action (default 60 for /s, /r)
/aAbort a pending shutdown/restart
/m \\computernameTarget a remote computer
/c "comment"Add a comment (displayed to users)

Examples

Shut Down Immediately (Default 60 Second Delay)

SHUTDOWN /s

The system will shut down in 60 seconds by default. Users see a notification and can save work.

Shut Down in 30 Seconds

SHUTDOWN /s /t 30

Restart the Computer

SHUTDOWN /r

Restart in 5 Minutes

SHUTDOWN /r /t 300

300 seconds = 5 minutes. Gives users time to save and close applications.

Log Off Current User

SHUTDOWN /l

Ends the current session without shutting down the computer. Useful for switching users.

Abort Pending Shutdown

SHUTDOWN /a

Cancels a shutdown or restart that was initiated with /t. Must be run before the delay expires.

Shut Down with Custom Message

SHUTDOWN /s /t 60 /c "Server maintenance in 1 minute"

The message appears in the shutdown notification dialog.

Remote Shutdown

SHUTDOWN /s /m \\SERVER01 /t 120

Shuts down the remote computer SERVER01 in 2 minutes. Requires admin rights and appropriate permissions.

Common Use Cases

  • Post-update restart – Script: install updates, then SHUTDOWN /r /t 60 to reboot
  • Scheduled maintenance – Use Task Scheduler to run SHUTDOWN at specific times
  • Remote server management – Restart servers from a central management station
  • Emergency stop – SHUTDOWN /a to cancel accidental shutdown
  • Multi-user environments – Log off without affecting other users (/l)

Tips and Best Practices

  • Always use /t with a reasonable delay (e.g., 60–300 seconds) to allow users to save work
  • Combine with TIMEOUT for user notification: echo Restarting in 5 minutes... & TIMEOUT /t 300 /nobreak & SHUTDOWN /r
  • For scripts, /t 0 forces immediate shutdown (use with caution)
  • Remote shutdown requires Admin$ share and firewall rules (SMB)

Troubleshooting

"Access is denied"

Run Command Prompt as Administrator. Shutdown and restart require elevated privileges.

"The system cannot find the file specified" (remote)

Check computer name, network connectivity, and that you have admin rights on the target.

Shutdown /a doesn't work

/a only works during the delay period. Once shutdown begins, it cannot be aborted.

"A system shutdown has been scheduled"

Another shutdown is already pending. Use SHUTDOWN /a first, then issue the new command.

Related Commands

timeout – Add Delay

Use TIMEOUT before SHUTDOWN to display a custom message: echo Saving... & TIMEOUT /t 60 /nobreak & SHUTDOWN /s

schtasks – Schedule Shutdown

Schedule SHUTDOWN for maintenance windows: schtasks /create /tn "Nightly Reboot" /tr "shutdown /r" /sc daily /st 03:00

logoff – Alternative Log Off

The LOGOFF command also ends the current session. SHUTDOWN /l is equivalent.

Frequently Asked Questions

How do I cancel a shutdown?

Run SHUTDOWN /a before the delay period expires. After that, shutdown cannot be aborted.

What is the default shutdown delay?

60 seconds when using /s or /r without /t.

Can I shut down immediately?

Use SHUTDOWN /s /t 0 for immediate shutdown. Use with caution; users may lose unsaved work.

How do I restart a remote computer?

Use SHUTDOWN /r /m \\ComputerName /t 60. Requires admin rights on the target.

What is the difference between SHUTDOWN /l and LOGOFF?

Both end the current user session. SHUTDOWN /l is more commonly used in scripts; LOGOFF has additional options for terminal server sessions.

Quick Reference Card

CommandPurposeExample
SHUTDOWN /sShut downDefault 60s delay
SHUTDOWN /r /t 120Restart in 2 minUser notification
SHUTDOWN /lLog offEnd session
SHUTDOWN /aAbort shutdownCancel pending

Summary

The SHUTDOWN command provides full control over system power state from the command line. Use /s, /r, and /l for shutdown, restart, and log off. Always consider /t for user-friendly delays and /a for safety. Practice in the simulator or browse the commands reference for more Windows command guides.