6 Clever Ways to Use the Windows Command Prompt

The command line may seem like an esoteric tool for developers and uber-hackers, but it has plenty of useful tricks up its sleeve. Here are a few easy things you can do from a terminal window that aren't necessarily available in your computer's traditional menus.

To open the command prompt in Windows, open the Start menu and search for "cmd." Press Enter or click on the result to open a command window—or right-click the option to run it as an administrator, when necessary. Even if your user is an administrator on the PC, you'll need to run command prompt as an administrator to run certain high-level commands.
Start a Shutdown Timer

Let's start with an easy one. Sometimes you have a process running—maybe you're downloading a big file or exporting a video or some other job that involves waiting—and you want to shut down your computer when it's done. Some programs have a built-in option to do so, but if it doesn't, you can turn to the command prompt. A simple command can tell your system to turn itself off after a predetermined length of time.

Say you want to shut down the computer in one hour. Open a command prompt and run:

shutdown -s -t 3600

You can adjust this command to fit your needs:

  • Shutdown is the main command—this doesn't change.
  • The -s flag tells the computer to shut down, though you could use -r to restart or -l to log off after the timer instead. (Sleep is a bit more complicated and would require a completely different command.)
  • The -t flag indicates the timer, and 3600 is the amount of time, in seconds, before you want to shut down. 3600 seconds is one hour, though you can adjust this value to whatever you want (7200 for two hours, etc.).
Rename a Bunch of Files at Once

Let's say you have a large folder of files—like photos or videos in sequence—with cryptic, hard-to-understand names (like IMG_001.jpg). Your first instinct is probably to go through and rename every file, but you don't have to do that—you can batch-rename a group of files at once with Windows' built-in tools.

If you select all the files (by clicking on the first one, holding Shift, and clicking the last one), you can actually right-click the selection and choose Rename to rename the whole batch. You'll end up with a list of files that have the same name with a number appended to the end in parentheses, like "Christmas 2020 (1).jpg."

But maybe you want to do the opposite—keep the existing file name but append a word to the end. For this, you can turn to the command line. Open a command prompt and use the cd command to navigate to the folder where those files are stored, like so:

cd "C:\Users\Whitson\Photos\Christmas 2020"

You'll need those quotes if your file path has any spaces in it, so don't forget them.

From there, you can run something like the below to rename all the files in the folder: