How To Shutdown Computer Using CMD (Command Prompt).

0
65
views

There would be many instance when you want to shut down your computer after certain time. Maybe you’re downloading a file from internet or running a scan on your pc. Well let me show you a trick by which you can schedule a shutdown after specific time.

Windows has inbuilt command function to do many task, one of which is to shutdown or restart computer using some command. We can use this feature to simplify our task.

Let me show you how it’s done.

1. By Using Command Prompt.

Command prompt is a powerful tool in windows. Windows was mainly designed to avoid much use of cmd so as to make it different and easy to use than Linux and bring a GUI friendly platform. But still many power users use cmd when they run into some problem or for troubleshooting purpose.

We will use cmd to shutdown our pc after certain time.

1.First go to start and type in cmd in search box. And then right click on cmd result and select ‘Run as administrator’ .Or alternatively you can press Ctrl+Shift+Enter to launch command prompt as admin.

2.Then type in the following commands in cmd.

shutdown -s -t <time in seconds> 

In time in seconds type in the desired time after which you would like pc to shutdown.

I will use 180 as time as I want my pc to shutdown after 3 mins.

shutdown –s –t 180

shutdown timer

Similarly you can modify the code according to timer. You can use -r instead of –s if you want to restart instead of shutdown.

shutdown –r –t <time in seconds>

There are many such option or parameters. You can have a look at all by typing shutdown /help in command prompt. To hibernate you can use.

shutdown –h –t <time in seconds>

helpcmd

3.You will receive a confirmation when you press enter.

confirm shutdown

4.To cancel the scheduled shutdown you can use the following command.

shutdown –a

Where -a stands for abort shutdown.

You will get a confirmation on successfully aborting the shutdown.

abort shutdown

2.By Creating A Batch File.

Now instead of typing this code each time you need to schedule a shutdown, restart or hibernate our pc we will create a bat file using notepad which will let us do this tasks using just a single click.

Follow me step by step now

1.Open notepad and copy paste the code I just shown you above.

notepad shutdown

2.Now give this file any name and save it with a .bat extension. Make sure that you select file type as All Files instead of txt file.

shutdown as bat

That’s it now save it on your desktop for easy access just double-click it whenever you want to schedule a shutdown. You can again use  shutdown –a to abort the scheduled shutdown.