howtothings.co.uk
(Batch) How to shutdown a computer using a batch file - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Programming Support, Graphic Design and Tutorials (https://www.howtothings.co.uk/forumdisplay.php?fid=14)
+--- Thread: (Batch) How to shutdown a computer using a batch file (/showthread.php?tid=7)



(Batch) How to shutdown a computer using a batch file - Mark - 22-05-2010

How to shutdown your computer using a batch file.


STEP ONE:

The shutdown command is used to make a computer turn off, reboot or log off.


STEP TWO:

To make a computer shutdown you type:

shutdown -s

[Image: 1yoo6f.jpg]


STEP THREE:

To make a computer log off you type:

shutdown -l

[Image: 34j7w21.jpg]


STEP FOUR:

To make a computer reboot you type:

shutdown -r

[Image: m9vdb9.jpg]


STEP FIVE:

To stop a computer from shutting down you type:

shutdown -a


[Image: 15i9gcg.jpg]


STEP SIX:

You may of noticed that the default time for these commands is 30 seconds, but you can change it.

To change the time from 30 seconds you type:

shutdown "what you want the computer to do" -t "ammount of time in seconds".

[Image: 119yyw6.jpg]

Where it says "what you want the computer to do" replace that with either -s, -l or -r.


STEP SEVEN:

To force a computer to shut down (Cannot be cancelled) you type:

shutdown "what you want the computer to do" -f


[Image: 2psi0s9.jpg]

The "-f" simply forces all running applications to close.

I hope this has helped.