How To Use A Command Prompt (With Definition And Tips)
Updated 8 December 2022
The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.
Command (cmd) prompt lets you manage the computer using various text commands. IT professionals find this application useful when performing advanced administrative functions, troubleshooting and solving computer-related issues. Learning more about the command prompt and how to use it can help you automate tasks and direct communication with the operating system. In this article, we discuss what a command prompt is, understand how to use a command prompt, explore its benefits and learn about commonly used commands and tips for using a cmd prompt.
What Is A Command Prompt?
The command prompt is a Windows application that works as a command-line interpreter. It issues various commands to the system, like file management commands that include delete and copy. A command prompt allows you to enter commands using a special syntax. The command lines that you write in the cmd prompt are lines of text, which the operating system executes when you press the ‘Enter' key.
Cmd asks Windows to launch the command prompt. It does not have a visual interface and uses a graphical user interface. Rather than using bars, lists, checkboxes, buttons and other graphical elements, the command prompt uses only text that you enter from the keyboard. You can use the cmd to copy, delete or rename files or folders, run applications, change settings and navigate through folders. Also, it provides details about your network status.
Related: 7 Common Desktop Support Interview Questions (With Answers)
How To Use A Command Prompt
To understand how to use a command prompt, follow these steps:
1. Start the command prompt
Click on the ‘Start' menu at the bottom left corner of your computer screen. In the ‘Search' bar next to the Windows icon, you can type ‘cmd'. Command prompt is the first search result that appears. From the drop-down menu list that appears on clicking the ‘Command Prompt' option, click on ‘Run as administrator'. You can even start the cmd prompt by pressing the ‘Windows' and ‘R' keys together. In the ‘Run' dialogue box that opens, type ‘cmd' and press ‘Enter' or click on the ‘OK' button. Using both methods, a black screen with plain text opens.
2. Start the shutdown timer
With the help of the command prompt, you no longer wait for a large file or a video to download. It helps you shut down the computer when your work gets completed. In the cmd Window, type 'shutdown -s -t' and the number of seconds after which you want to shut your system. For instance, if you want to shut down your computer after two hours, use the following command:
C:/Users/Documents>shutdown -s -t 7200
Here,
‘-s' flag tells the computer to shut down. Instead of ‘-s', you can use ‘-r' to restart ‘-l' to log off after the timer.
‘-t' flag shows the timer and 7200 represents the amount of time in seconds.
This command uses seconds to measure the time instead of minutes or hours. If you want to shut your system in 20 minutes, use 1200 seconds. Press the enter key after inputting the syntax. A pop-up warning appears, stating that the windows would shut down after the time you requested. If you want to cancel the shutdown timer, use the following syntax:
C:/Users/Documents>shutdown -a
Related: 17 Active Directory Interview Questions And Example Answers
3. View a saved Wi-Fi password
You can retrieve the network password saved on your Windows laptop using the command prompt. In the cmd window, type the following command, ‘Netsh WLAN show profile name=“Wi-Fi name” key=clear' and press the enter key.
For instance:
C:/Users/documents>Netsh WLAN show profile name=“Reyansh_Wifi” key=clear
This command displays connectivity, security and cost settings. Under the security setting, you can find ‘Key Content' that provides information about your Wi-Fi password. If you want to know about every Wi-Fi password that your computer connected, you can use the following command:
for /f “skip=9 tokens=1,2 delims=:” %i in (‘netsh WLAN show profiles) do @echo %j | findstr -i -v echo | netsh WLAN show profiles %j key=clear
4. Rename multiple files
Often, when you have multiple images and videos with cryptic filename, renaming them individually might be challenging. Using the cmd prompt, you can rename multiple files at once. Start the renaming process by navigating to the desired folder in the cmd prompt. Rather than using the 'cd' command multiple times, focus on using the following syntax:
cd “C:\Users\Documents\Photos\ Holidays 2021”
You require a quotation if the file path has any spaces in it.
If you want to rename 'jpg' files, type:
C:/Users/Documents/Holidays 2021>ren *jpg ????-Winter-break-holiday
Here,
'*' acts as a wildcard. The command takes all 'jpg' files from the target folder and adds the 'Winter-break-holiday' extension at the end of each file's name.
'???' shows that the command prompt keeps four letters from the original filename. For instance, if the original file name was 'Family.jpg', the filename changes to 'Fami-Winter-break-holiday.jpg'.
In the above command, ‘*' means any file in the selected folder. You can adjust this to 'IMG*.*' to limit the renaming to files that start with IMG.
Related: What Does An IT Professional Do? Duties And Requirements
5. Erase a drive
When removing files from the SD card or migrating your PC to a new drive, it might not be challenging to remove all the data cleanly. This is where the command ‘diskpart' comes helpful. Type ‘diskpart' and press the ‘Enter' button on the command prompt.
C:/Users/Documents> diskpart
DISKPART>
The ‘DISKPART' prompt opens, type ‘list disk' and press ‘Enter' in this prompt.
DISKPART> list disk
You can now view all the disk numbers in the text format in the command prompt. Select the drive you want to permanently delete as you return to the ‘DISKPART' prompt.
Now, enter the command, ‘select' followed by the disk number.
DISKPART>select disk 1
This command displays a message that the disk is selected. In the ‘DISKPART' prompt, type the following command.
DISKPART>clean
You return to the ‘DISKPART' prompt. After this command, the command prompt displays the message ‘DiskPart succeeded in cleaning the disk'.
What Are Some Widely Used Commands In A CMD?
Here are some widely used commands in a cmd:
‘time': This command helps in setting the computer's time. It displays the current time and allows you to set the computer time.
‘verify': This helps understand whether the system writes all files correctly on a disk.
‘systeminfo': This command displays the configuration and properties of your computer.
‘driverquery': The absence of a driver can affect the performance of your work. Using this command, you can get a complete list of installed drivers on your computer.
‘tasklist': This command provides a list of tasks running on the computer. It also gives details about the memory usage of every task.
‘mkdir': Use the ‘mkdir' command to make a new folder. The syntax for the command is ‘mkdir Foldername'.
‘cls': For clearing the existing commands in the command prompt, use the ‘cls' and press the enter key.
'ipconfig': This command provides information about your current network adapter, including subnet mask, current domain, current IP address and current domain.
Related: What Is An MIS System? (Definition, Importance And Benefits)
Tips For Using A Command Prompt
Here are some tips for using a command prompt:
Ensure you run the cmd as administrator. When performing a desired action on a file, folder or application, it is essential to run the command prompt as an administrator. So, whenever possible, use 'Window + R' to open the cmd as an administrator.
Use the shortcuts. Using the Function keys from F1 to F9, you can quickly re-enter commands without retyping them again. This helps in saving time and ensures accuracy.
Use the ‘Help' function. Type ‘Help' into the command prompt when performing any command in the cmd. This provides a list of commands commonly used by developers.
Change the title of the cmd window. If you are working on multiple tasks, it might be challenging to open multiple cmd prompts with the name ‘C:/Windows/system32/cmd.exe'. So, type ‘Title' followed by the text you want the title bar to read.
Use ‘CTRL+C' to abort a command. If you have not executed a command, you can use backspace and erase the command. But, if the command is executing, you can press ‘Ctrl + C' to stop the operation.
List all installed programmes. Using the command prompt, you can list all tools, programmes and apps installed on your computer. Type ‘wmic product get the name' and see the list of all installed programmes.
Please note that none of the companies, institutions or organisations mentioned in this article are associated with Indeed.
Related:
Explore more articles
- What Are User Onboarding Tools? (With Benefits And Examples)
- 10 Application Monitoring Tools (With Tips To Choose One)
- Inventory To Sales Ratio (Definition And Importance)
- Coaching Skills: Definition, Examples And How To Improve
- Skills For A Sales Associate: Definition And Examples
- Cash Account: Definition, Purpose, How To Open One And FAQs
- What Is A Finance Management System? (With Benefits)
- Different Types Of Portfolio Management (With Advantages)
- Guide On How To Calculate Conversion Rate (With An Example)
- What Is Personnel Management? (With Objective And Types)
- What Are BPM Tools? (With 15 Useful Examples Of Tools)
- What Is Technical Documentation, And How Do You Create It?