How to shutdown your Windows computer using a batch file.
You can use the shutdown command in a command prompt or a PowerShell console to make a computer log off, reboot or turn off.
To make a computer log off you type:
To make a computer reboot you type:
To make a computer shutdown you type:
To stop a computer from shutting down you type:
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 “amount of time in seconds”.
Where it says “what you want the computer to do” replace that with either -s, -l or -r.
e.g. shutdown -s -t “10”
To force a computer to shut down (Cannot be cancelled) you type:
shutdown -s -f
The “-f” forces all running applications to close.