CMD - 11 Basic Commands You Should Know (CD, Dir, Mkdir, Etc.)
CMD - 11 Basic Commands You Should Know (CD, Dir, Mkdir, Etc.)
Advertisement
Advertisement
UP
CONTENTS The holidays are around the corner, and pretty much
everyone is caught up in the Christmas shopping
1. How to change the directory in CMD (CD in Command Prompt) fever. We all want to offer our loved ones joyful and
How to go to the root of the drive, in CMD (CD\)
How to navigate to a specific folder in CMD (CD path)
How to change the parent directory in CMD (CD..)
How to change directory in CMD to desktop (or other user folders)
2. How to change the drive in CMD (Command Prompt)
3. How to view the contents of a directory in Command Prompt (DIR in CMD)
Christmas shopping: ASUS routers and mesh
4. How to create a new directory with Command Prompt (MD in CMD) Wi-Fi I recommend
5. How to rename files and folders with Command Prompt (REN in CMD) MISC Ciprian Adrian Rusen 12.12.2022
6. How to copy files in CMD (COPY in Command Prompt) Do you want a faster Wi-Fi network with a larger
7. How to copy folders in CMD, including their contents (XCOPY in CMD) coverage area this holiday season? Are you having a
8. How to delete files with Command Prompt (DEL in CMD) house full of guests this Christmas and want a more
NOTE: The information shared in this tutorial applies to Windows 11, Windows 10, and even older Create and activate a Parental Controls profile
on your TP-Link Deco
Microsoft operating systems such as Windows 7.
TUTORIAL Ciprian Adrian Rusen 06.12.2022
1. How to change the directory in CMD (CD in Command Prompt) TP-Link Deco mesh Wi-Fi systems have many
The first command from the list is CD (Change Directory). This command enables you to change the features, including parental controls that are very
useful to families with children. If you don’t want
current directory or, in other words, to navigate to another folder from your PC.
Advertisement
How to go to the root of the drive, in CMD (CD\)
The first iteration of the CD command you should know is CD\. It 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 should see how the CD\ command takes you to the top of
the directory tree. In this case, to the C: drive.
POPULAR REVIEWS
The Command Prompt is not case sensitive, meaning that you can type commands using capital
letters, lowercase, or any combination of them. The commands CD, cd, or Cd, all work the same way.
NOTE: Did you notice in the screenshot above that Command Prompt looks slightly different than
what you’re used to? That’s because we’re using it inside the Windows Terminal. For more
information, read: What is the Windows Terminal? Intel Core i9-13900K review: Leading the
Raptor pack
How to navigate to a specific folder in CMD (CD path) REVIEW Codrut Neagu 07.12.2022
by a backslash character: \. For instance, when you need to access the System32 folder located in
C:\Windows, type:
cd windows\system32\
SEARCH
SUBSCRIBE
CATEGORIES OTHER
How to navigate to a folder in CMD
When you need to go one folder up, use the cd.. command. Let's assume that you’re inside the ENTERTAINMENT ABOUT US
system32 folder and want to go back to the Windows folder. Type SECURITY NEWSLETTER
SMARTPHONE TERMS
cd..
SMARTHOME COOKIES
Advertisement
Advertisement
What about changing the directory in CMD to a personal folder, like your Desktop or Documents? It’s
done the same way, using the CD command, but you need to know the locations of your personal
folders. In both Windows 10 and Windows 11, all user folders are found in:
C:\Users\[username]\
For example, to change the directory in CMD to your Desktop, the command you’ll have to run is
this:
cd C:\Users\[your_user_name]\Desktop
Similarly, if you want to navigate to another user folder in CMD, run the same command but replace
Desktop with the directory you need to get to. For example, if you want to change the path to your
Documents folder, run:
C:\Users\[your_user_name]\Documents
TIP: Alternatively, instead of entering the name of your user folder manually, you can replace the
path to a directory in CMD with the %userprofile% environment variable. Here’s an example of how
to change the directory in CMD to Desktop:
cd /d %userprofile%\Desktop
d:
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
NOTE: By typing only the drive letter you automatically move to your most recent location on that
drive. For instance, if you are on the D: drive and type cd C:\Windows nothing seems to happen.
However, if you type C: afterward, then the working folder changes to C:\Windows.
Advertisement
The last time, our working folder was C:\Windows. To navigate to the folder mentioned above, we
have to use the command cd /d D:\Digital_Citizen. To view the contents of the folder, type:
DIR
… and press Enter. This displays a list of the files and folders contained in it, together with some
details about each of them (the size and the date and time when they were last modified).
MKDIR Folder
or
MD Folder
Let's say we need to create a new folder called Digital_Citizen_Life that is going to be placed in the
D:\Digital_Citizen folder. To do that, we need to type:
mkdir Digital_Citizen_Life
TIP: If you want to create a folder that contains spaces in its name, make sure to wrap its name
between quotes or apostrophes. For example, if you want to create a folder called Digital Citizen,
run the MD command like this:
md “Digital Citizen”
To test if it worked, use the DIR command again. The newly created folder appears in the list.
IMPORTANT: Do not forget that all these commands depend on your current location in the
Command Prompt. For instance, if you are on the C: drive and type MKDIR test, the new folder is
created in the root of the C: drive.
Another way to create a folder without having to go to the desired location for it 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
When you need to create a folder with subfolders at the same time, you can use this command:
MKDIR Folder\Subfolder
.
For instance, if we type:
mkdir Digital_Citizen_Tests\Beta\Test1
… three folders are created: Digital_Citizen_Tests, Beta, and Test1, in a tree-like structure.
5. How to rename files and folders with Command Prompt (REN in CMD)
To rename files and folders, you need to use the REN (Rename) command. To rename folders, type:
For instance, to rename the Digital_Citizen_Picture1.bmp file to Image0.bmp, we have to run the
command:
For example, let's use this command to copy the Image0.bmp 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. To do all that, we must type the
command:
… followed by Enter. You should also receive a confirmation of the operation, as you can see below.
If you are copying within the same directory, you do not have to include the path in the command.
As an example, let’s copy Digital_Citizen_Notes.txt from D:\Digital_Citizen in the same folder, only
with a different extension: let's say Digital_Citizen_Notes.docx. To do that, we have to run the
command:
XCOPY /s /i
The /s parameter ensures that all the directories and subdirectories are going to be copied, except
the ones that are empty. The /i parameter creates a new directory if the destination folder does not
exist and copies all the files in it.
del folder
For instance, let’s say we want to delete all the files from the Digital_Citizen_Tests folder found in the
D:\Digital_Citizen directory. For that, you first open the Digital_Citizen folder in Command Prompt
and then you run this command:
del Digital_Citizen_Tests
You must confirm the delete process by typing the letter y for Yes, and then pressing Enter.
NOTE: To also delete hidden files from the folder, you must add the /h parameter. Also, note that
the DEL command does not work for deleting folders - for that, you have to use the RD command,
covered in the next section of this tutorial.
Using the DEL command to delete all the files in a directory in Command Prompt
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
DEL *.DOCX
… deletes all the files in the current folder that have the DOCX extension (you can use any file
extension necessary, DOCX is just an example).
DEL Test*.*
… deletes all the files in the working folder whose names begin with Test.
DEL *.*
RD [Folder]
We have previously deleted all the files from the Digital_Citizen_Tests folder. It is now time to delete
the directory too, by typing:
RD Digital_Citizen_Tests
cd /d c:\windows\System32\
control.exe
Alternatively, you can also run an app from CMD directly, no matter what folder you’re currently
browsing, by specifying the app’s executable file and its full path in Command Prompt. Opening
Control Panel from the previous example would look like this, regardless of your current directory in
CMD:
C:\Windows\System32\control.exe
help
… and then press Enter. This displays a list of all the available commands, as you can see below.
If a particular 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:
Using the HELP command or the /? parameter to find help in Command Prompt
NOTE: This tutorial covers only a couple of commands for Command Prompt. If you want to delve
deeper, you can also read:
COMMENT
Email SUBSCRIBE
Subscribe:
RELATED ARTICLES
How to open Command 20 best Command 34 keyboard shortcuts for How to switch between
Prompt when Windows Prompt (CMD) Windows 10's Command CMD and PowerShell in
doesn't boot (3 ways) commands you should Prompt Windows Terminal
know