Windows 10

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


    Your PC will start shutting down immediately:

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:
    Uncheck Hide extensions for known file types: 
  • Rename “txt” extension to “bat”:
    This is an example on how to name the bat file:

    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.

Adam Swift

Adam is a real tech maniac. He likes to spend time testing phones, tablets, laptops, as well as any other technical devices, and write practical manuals on their functions. He often sleeps all day, but always works at night. Adam bought his first computer in 1999, being an absolute beginner who never held a computer mouse in his hands. He began to study Windows, constantly experimented and often crashed the operating system. But six months later, he was able to reinstall Windows 98 from a scratch on his own, fix almost any software problem on a PC, he also did hardware upgrades and realized that computers, operating systems and programs are now his biggest passion. In addition, Adam has always been a big lover of phones. With the advent of smartphones with Android OS, he began to pick at them much more than in computers. Now Adam loves to study privacy issues in instant messengers, blocking unwanted calls and other nuances related to privacy and security on the network. You can follow him on Twitter: https://twitter.com/tunecomp

View Comments

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

    • bruh for both this and the one explained, my antivirus thought it was a god damn trojan... why the hell would i put my own virus on my computer. kaspersky dumb.

  • 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.

  • Can you send this to a friend and when they open it their pc shutdowns?

    • 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.

    • 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

Published by
Adam Swift

This website uses cookies.

Read More