Command Prompt – How to use the simple, basic commands

by Codrut Neagu published on 05/11/2016. digitalcitizen . life

Geeks and experts all love the Command Prompt because of the advanced tasks and commands you can run in it. But that doesn’t mean that it’s only useful for experts – after all, every expert was a novice in the beginning. And Command Prompt is not built only on advanced commands, but also on simple commands designed to perform basic operations. In this article we will show you how to execute commands like changing the working folder, viewing the contents of a directory, creating and renaming folders, copying, deleting files and folders, and launching any application from the Command Prompt. We will also see how to get help when using this tool.

NOTE: The information shared in this tutorial applies to Windows 10, Windows 8.1 and Windows 7. Note that, for simplicity, we will use screenshots taken only in Windows 10.

How to navigate between folders


The first command from the list is CD (Change Directory). This command enables you to change the current folder or, in other words, to navigate to another folder from your computer.

For instance, the command CD\ takes you to the top of the directory tree. To see how it works, after you open the Command Prompt, type cd\ and press Enter on your keyboard. You will see that the CD\ command takes you to the top of the directory tree (in this case to the “C:” drive).

Opera Snapshot_2018-01-11_220304_www.digitalcitizen.life

NOTE: Command Prompt is not case sensitive, meaning that commands can be typed with capital letters, lowercase or any combination of them. The commands CD, cd or Cd will all work in the same way.

Going back to the “CD\” command, now you are working on the root of the “C:” drive. If you need to go to a specific folder from this drive run the command “CD Folder”. The subfolders must be separated by a backslash character: “\”. For instance, when you need to access the System32 folder located in “C:\Windows”, type “cd windows\system32\” as shown below, and then press Enter on your keyboard.

Opera Snapshot_2018-01-11_220416_www.digitalcitizen.life

When you need to go to one folder up, use the “cd..” command. Let’s assume that you want to go back to the Windows folder. Type “cd..” and press Enter on your keyboard. You will notice that your current directory has changed to ”C:\Windows”.

Opera Snapshot_2018-01-11_220459_www.digitalcitizen.life

How to access a certain drive


To access another drive, type that drive’s letter, followed by “:”. For instance, if you wanted to change the drive from “C:” to “D:”, you should type “d:” and then press Enter on your keyboard.

Opera Snapshot_2018-01-11_220631_www.digitalcitizen.life

To change the drive and the directory at the same time, use the cd command, followed by the “/d” switch. The “/d” parameter is used to change the current drive to a specific folder from another disk volume. For instance, if you are now on the ”D:” drive and you want to go back to the Windows folder from the“C:” drive, you should type “cd /d C:\Windows” and press Enter on your keyboard, like in the following screenshot.

Opera Snapshot_2018-01-11_220737_www.digitalcitizen.life

NOTE: By typing the drive letter you automatically move to your most recent location in that drive. For instance, if you are on “D:” drive and type “cd c:\windows” nothing seems to happen. But if you type “c:”, then the working folder will change to “c:\windows” (assuming that it was the last folder you worked with on your “C:” drive).

How to view the contents of a folder
You can view the contents of a folder by using a simple command called DIR. To test it, we’ve created a folder named Digital_Citizen on the D: drive, with several files and subfolders.

Opera Snapshot_2018-01-11_220903_www.digitalcitizen.life

The last time, our working folder was “C:\Windows”. We will navigate to the folder mentioned above by using the command “cd /d D:\Digital_Citizen”. To view the contents of the folder we will type DIR and press Enter on the keyboard. A list of the files and folders contained by it is displayed, together with some details about them (the size and the date and time when they were last modified).

Opera Snapshot_2018-01-11_221019_www.digitalcitizen.life

How to create a new folder from the Command Prompt


You can make a new directory using the MKDIR (Make Directory) or the MD command. The syntax of these commands is “MKDIR Folder” or “MD Folder”.

Let’s say we need to create a new folder called Digital_Citizen_Life that will be placed in the “D:\Digital_Citizen” folder. We will type “mkdir Digital_Citizen_Life” and then we will press Enter, as shown below.

Opera Snapshot_2018-01-11_221127_www.digitalcitizen.life

To test if it worked, we will use again the dir command. The newly created folder appears in the list.

Opera Snapshot_2018-01-11_221242_www.digitalcitizen.life

NOTE: Don’t forget that all these commands depend on the current location in the Command Prompt. For instance, if you are on the “C:” drive and type “MKDIR test”, a new folder will be created in the root of the “C:” drive.

Another way to create a folder, that doesn’t involve being in the desired folder, is to type the complete path of the new folder. For example, if you are working on the “D:” drive and you want to create a new folder in “C:”, called other_stuff, type “mkdir c:\other_stuff” and then press Enter.

Opera Snapshot_2018-01-11_221351_www.digitalcitizen.life

When you need to create a folder with subfolders at the same time you can use the ”MKDIR Folder\Subfolder” command . For instance, if we type “mkdir Digital_Citizen_Tests\Beta\Test1” three folders will be created: Digital_Citizen_Tests, Beta and Test1, in a tree-like structure.

Opera Snapshot_2018-01-11_221504_www.digitalcitizen.life

How to rename files and folders


To rename files and folders you need to use the REN (Rename) command.

To rename folders, type “ren Folder NewFolderName”. For example, if we wanted to rename the Digital_Citizen_Tests folder to Digital_Citizen_Final_Tests, we should run “ren Digital_Citizen_Tests Digital_Citizen_Final_Tests” and then press Enter.

Opera Snapshot_2018-01-11_221607_www.digitalcitizen.life

To rename a file, use the same command, like this: “ren filename.extension newname.extension”. For instance, to rename the Digital_Citizen_Picture.jpg file to Picture1.jpg we have to run the command “ren Digital_Citizen_Picture.jpg Picture1.jpg” command.

Opera Snapshot_2018-01-11_221708_www.digitalcitizen.life

Copy files and folders


The Copy command allows you to copy files from one location to another. To use this command you have to type

“copy location\filename.extension newlocation\newname.extension”.

For example, let’s use this command to copy the Picture1.jpg file from the Digital_Citizen folder located on the “D:” drive to the

“D:\Digital_Citizen\Digital_Citizen_Tests\ folder.

To make things more interesting we want the file to be named Testing_Picture1.gif. We will write the command

“copy D:\Digital_Citizen\picture1.jpg

:\Digital_Citizen\Digital_Citizen_Tests\testing_picture1.gif”

followed by Enter. You will receive a confirmation of the operation, as you can see below.

Opera Snapshot_2018-01-11_221914_www.digitalcitizen.life

If you are copying within the same directory you don’t have to put the path in command. As an example, we will copy Digital_Citizen_Notes.txt from “D:\Digital_Citizen” in the same folder, only with a different extension: let’s say Digital_Citizen_Notes.doc. To do that, we have to run the command “copy Digital_Citizen_Notes.txt Digital_Citizen_Notes.doc”.

Opera Snapshot_2018-01-11_222022_www.digitalcitizen.life

To copy a folder and its content from a location to another, use the XCOPY command followed by the “/s /i” operators. Let’s assume that we need to copy a folder from “D:\Digital_Citizen” to “C:\Backup_Digital_Citizen”. To do that, we’ll have to run the command “xcopy /s /i d:\Digital_Citizen c:\Backup_Digital_Citizen”. The “/s” parameter will ensure that all the directories and subdirectories will be copied, except the ones that are empty. The ‘/i’ parameter will create a new directory if the destination folder doesn’t exist and will copy all the files.

Opera Snapshot_2018-01-11_222122_www.digitalcitizen.life

Delete files and folders


The DEL (Delete) is used to delete files from the folders you’ve created. To delete all the files from a folder you have to run the command “del folder”. For instance, from the directory Digital_Citizen found on the “D:” drive, we will delete all the files from the Digital_Citizen_Tests folder, by typing the command “del Digital_Citizen_Tests”. You need to confirm the delete process by typing the letter “y” and then press Enter.

NOTE: To also delete hidden files from the folder, you must add the “/h” parameter. Also note that the DEL command doesn’t work for deleting folders – for that, you’ll have to use the RD command of which we’ll talk in a bit.

Opera Snapshot_2018-01-11_222236_www.digitalcitizen.life

If you need to delete a single file, use the DEL command followed by that file’s name. For instance, to delete the file Digital_Citizen_Notes.txt from “D:\Digital_Citizen”, we should run the command “del Digital_Citizen_Notes.txt”.

Opera Snapshot_2018-01-11_222340_www.digitalcitizen.life

Here is a list of useful DEL combinations that are worth mentioning:

  • DEL *.DOC – delete all files with the DOC extension (you can use any file extension necessary, DOC is just an example);
  • DEL Test*.* – delete all files beginning with Test;
  • DEL *.* – delete ALL files from the current folder.

The DEL command cannot be used to delete folders, therefore we will use another command to remove any empty folder: RD (Remove Directory). We’ve previously deleted all the files from the Digital_Citizen_Tests folder. It’s time to delete it by typing ”RD Digital_Citizen_Tests”.

Opera Snapshot_2018-01-11_222507_www.digitalcitizen.life

Launch an application from the Command Prompt


To run a program from the Command Prompt, you need only to navigate to the folder that contains the executable and type the program’s name. For example, if you want to launch Paint using Command Prompt, go to “C:\Windows\System32” and you will find the executable called mspaint.exe. Let’s see how this operation is done, if you were in “D:\Digital_Citizen”. First off all, change the working directory to the application’s folder by typing “cd /d c:\windows\System32\”. Then write mspaint.exe or simply mspaint and press Enter. Both commands can be seen in the screenshot below.

Opera Snapshot_2018-01-11_222612_www.digitalcitizen.life

How to get help in Command Prompt


To access help in Command Prompt you have to type the help command and then press Enter. A list with all available commands will be displayed, as you can see below.

Opera Snapshot_2018-01-11_222824_www.digitalcitizen.life

If a certain command interests you, type help followed by the name of that command. Another way to do the same thing is to type the command’s name followed by the “/?” parameter. To test it, use “help cd” or “cd/?” to display information about the cd command. In the picture below you can see the result.

Opera Snapshot_2018-01-11_223010_www.digitalcitizen.life

Conclusion


The Command Prompt remains a very powerful tool for any computer user who is willing to get his hands dirty and learn new things. We hope this article was useful in helping you learn the basics about running commands in the Command Prompt. If you have any questions about it, don’t hesitate to leave us a comment below.

Command Prompt – View system information and manage running processes

by Codrut Neagu published on 05/26/2016. digitalcitizen . life

The easiest way to view information about your computer is to use Windows built-in graphical tools like the Task Manager or System Information . However, just like us, some people prefer to use the Command Prompt for, well, anything. That’s why, in this article, we thought it would be useful to show you how to view the complete system information directly from the Command Prompt , as well as how to manage your running processes, all with the use of just a few advanced commands:

NOTE: The information shared in this tutorial applies to Windows 10, Windows 8.1 and Windows 7. For simplicity, we will use screenshots taken in Windows 10.

1. How to view your system information


Command Prompt allows you to view system information by using a simple command called systeminfo . Open Command Prompt , type systeminfo and press Enter . Do you s ee what’s happening? Just like in screenshot below, a complete list of information about your operating system and computer hardware and software components is displayed.

You will see details such as the version of the operating system installed on your computer, the status of your RAM memory or the processor you have. There’s also some network information, like the IP and the MACaddresses of your network cards.

command_prompt_0

2. Display the list of currently running processes


To view the list of currently running processes, you have to use the tasklist command. Type tasklist and press Enter . Command Prompt should display a list similar to the one below, where you see details about the names of running processes, their PID (Process identifier) and the memory they use.

command_prompt_1

3. Stop a process using taskkill


To kill or stop a running process, you have to use the taskkill command. Let’s assume that you want to stop the Snipping Tool application t hat is running on your computer. Its process is called SnippingTool.exe . In order to kill it, you should use Command Prompt to run the command “taskkill /im snippingtool.exe” . The /im parameter is used to identify and stop a process by typing its name.

command_prompt_2

There are times when you need to open a program twice or even several times. Every new window of a specific program (for example, Internet Explorer ) creates a separate process called instance that has attached a unique PID (Process identifier).

To stop a single instance of a process, you need to specify its PID(Process identifier). Let’s assume that there are two instances of Internet Explorer open on your computer . The process’ name is iexplore.exe , but you want to close only one of its two running instances.

command_prompt_3

If you want to kill the process that has a PID of 6984, you will type taskkill /PID 6984 and then press Enter .

command_prompt_4

Another interesting parameter that you can use for the command taskkill is /t . This parameter allows you to terminate a specified process and any child processes which were started by it.

Take the same example: the Internet Explorer process. Let’s assume that you have three processes and you want to kill all of them using the parameter /t . You should type the command “taskkill /t /im iexplore.exe” and then press Enter . Check the screenshot below to see the confirmation of the command you just typed.

command_prompt_5

Note that if you misuse the commands listed in this article, you can risk losing the data opened in the running processes. It is important to be careful and have a backup available for your data. Therefore proceed carefully and don’t say we did not warn you. 🙂

Also, keep in mind that, in order to kill any running process, you need to have administrative permissions and run the Command Prompt as administrator. Check out the 7 ways to run programs as administrator in Windows to see how to run Command Prompt as administrator.

Conclusion


We hope you’ve liked this guide which continues our series of advanced commands that can be run in the Command Prompt . Now you know how to display the system information and you know how to stop processes, all by using just some text commands in the Command Prompt . Don’t you feel geeky right now? 🙂 Don’t forget that, if you have any questions about the commands shared in this article, you can always leave a comment below.