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:
- Run the command prompt.
- Type the command and press Enter:
shutdown /s /f /t 0
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.
12 thoughts on “How to shutdown the computer using cmd or a bat file”
To be honest…no. make a shortcut file on the desktop, enter new name;
shutdown -f -s -t 00
shutdown -f -r -t 00
This command worked better on Windows 7 Pro.
thank you so much!
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.
then log into administrator, who logs into standard acounts anyways.
Its not that hard you can do that right now
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
yes, i have made a program which does just this when opened