Batch (.bat or .cmd) files are unformatted text files and contain one or more commands that simplify tasks. When you run a batch file, the operating system runs the commands in a line-by-line order. You can use Microsoft Notepad to create batch files to run routine tasks, such as shutting down your computer.
- Skill level:
Other People Are Reading
Open Notepad by clicking the "Start" button, typing "notepad.exe" in the text box and pressing "Enter" on your keyboard.
Type "shutdown" and type the arguments for the shutdown. Add a space with your space bar after "shutdown." Separate arguments, and any values you provide with the argument, by using a space. The argument you use to shut down a computer is "-s". Use the "-r" argument to shut down and restart the computer or the "g" argument to shut down, restart the computer and restart registered programs after the computer restarts.
For example, to simply shut down a computer, type:
Add optional arguments. Note that some arguments cannot be used if you use other arguments.
Some arguments you may want to use include "-t", which you can use to specify the time, in seconds, before the computer shuts down and "-c," which you can use to provide a message when the computer is shut down. After the "-t" argument, type the number of seconds; after the "-c" argument, type the comment enclosed in double quotation marks ( " " ).
For example, to create a batch file that shuts a computer down after 100 minutes and displays the message "Computer shutdown," type:
shutdown -s -t 6000 -c "Computer Shutdown"
Save the text file as a batch file. Click "File" and select "Save as."
Navigate to the location where you want to save the file and type a name for the file in the "File name" field. Use the file extension ".bat." or ".cmd." For example, use the file name "shutdown.bat" or "shutdown.cmd."
From the "Save as type" drop-down box, select "All Files;" then click "Save."
Right-click the file and select "Run as administrator" to run the batch file. If you configured optional information such as comments or a shutdown timeout interval, Microsoft Windows displays the information as a pop-up message in the status bar.
For example, for a batch file with the content "shutdown -s -t 6000 -c "Computer shutdown," the status message indicates that the computer will shut down in 100 minutes and displays the "Computer shutdown" comment.
Tips and warnings
- You can view the arguments that you can use in a shutdown batch file by clicking "Start" and typing "shutdown /?" in the text box.
- If the computer is not set to shut down immediately, you can stop the computer from restarting by clicking "Start" and typing "shutdown -a" in the text box.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for