If you want your PC to automatically shut down or restart after a specific time, you can easily do it using Command Prompt (CMD).
This method is useful when:
You are downloading large files
You want to sleep without turning off PC manually
You want to schedule restart
Follow this simple step-by-step guide.
📌 What is Auto Shutdown Command?
Windows provides a built-in command:
shutdown
This command allows you to:
Shut down PC
Restart PC
Set timer
Cancel shutdown
⏱️ Set Auto Shutdown Timer
Basic Command:
shutdown -s -t 60
👉 This will shut down PC after 60 seconds (1 minute)
Examples:
5 minutes:
shutdown -s -t 300
1 hour:
shutdown -s -t 3600
👉 Time is always in seconds
🔁 Set Auto Restart Timer
To restart instead of shutdown:
shutdown -r -t 60
✔️ Same timing rules apply
❌ Cancel Shutdown or Restart
If you want to stop the timer:
shutdown -a
👉 This will cancel any scheduled shutdown/restart
⚙️ How to Run Command
Press Windows + R
Type:
cmd
Press Enter
Type your command
🧩 Create Shortcut for Auto Shutdown
You can create a one-click shortcut:
Right-click Desktop
Click New → Shortcut
Enter:
shutdown -s -t 600
Click Next → Finish
Now double-click to start timer.
🚀 Benefits of This Trick
No software required
Quick and easy
Fully customizable
Works on all Windows versions
Useful for automation
⚠️ Important Tips
Save your work before timer ends
Double-check time (seconds)
Use cancel command if needed
Avoid using very short timers accidentally
📝 Final Words
Auto shutdown and restart using CMD is a simple and powerful trick in Windows. It helps automate your tasks and saves time.
Once you understand the commands, you can easily control your PC timing.
For more Windows tricks and guides, visit CodeSardar.
❓ Frequently Asked Questions
Q1. Can I set shutdown for 2 hours?
Yes, use shutdown -s -t 7200.
Q2. How to cancel shutdown?
Use shutdown -a.
Q3. Does this work on Windows 11?
Yes, it works on all versions.
