How to shutdown the computer using cmd or a bat file

The question: I need to shutdown my computer immediately (without waiting) using cmd. How can I do it? From this article you will learn how to shutdown your PC using the command prompt and using the bat-file on Windows 10 example.

How to shutdown the computer using cmd

If you want to turn off your desktop or laptop immediately, follow these steps:

  1. Run the command prompt.
  2. Type the command and press Enter:
    shutdown /s /f /t 0

    shutdown -s -f -t 0
    Your PC will start shutting down immediately:
    windows 10 shutting down

How to shutdown the computer using the bat file

  • Right-click the empty space on your desktop or in any folder.
  • Select New → Text Document.
  • Copy and paste the string into the document:
    shutdown /s /f /t 0
  • Press Ctrl+S to save the file in .txt format.
  • Show extensions for registered file types. Click View – Options:
    explorer view optionsUncheck Hide extensions for known file types: hide extensions for known file types
  • Rename “txt” extension to “bat”:
    rename file extensionThis is an example on how to name the bat file:
    turn off pc bat

    Do not name the file “shutdown”! Otherwise it will launch itself in a cycle and won’t work!

Now all you need to immediately shutdown your computer is just launch the bat-file.

12 thoughts on “How to shutdown the computer using cmd or a bat file”

  1. To be honest…no. make a shortcut file on the desktop, enter new name;
    shutdown -f -s -t 00
    shutdown -f -r -t 00

    Reply
  2. So simple right? No!, this wont work unless you are logged in as Administrator, the script is running as Administrator, and UAC is turned off. You would have to be stupid to do all these things, and then you would blame Windows 10.
    To work, the script needs to, 1. Run as administrator, and 2. turn off UAC just before it executes the shutdown command. Otherwise it will not work.

    Reply
    • If you have a friend who clicks on scripts without knowing what they do, yes, you can do a lot worse than just shut their PC off.

      Reply
    • Even better, secretly make this file on their computer, place it in the startup programs folder.
      So when the computer turns on, it immediately shuts down

      Reply

Leave a Comment