If you're new to the Command Prompt (cmd) on Windows, this section will help you get started with the basics.
To open the Command Prompt:
- Press
Win + R
to open the Run dialog. - Type
cmd
and pressEnter
.
Alternatively, you can search for "Command Prompt" in the Start menu.
To list the contents of the current directory:
dir
Here you can see the list of files and folders in my current directory
Use the cd
command to change the current working directory:
cd name-of-the-directory-you-want-to-go
Here you can see I am going to the folder name
If you have multiple drives, switch between them using the drive letter:
D:
Here you can see first I am going to D drive and then E drive
In the Windows Command Prompt, you can use the echo
command to create a new file and the mkdir
command to create a new folder. Here's how you can do it:
You can use the echo
command to create a new text file. For example, to create a file named example.txt
, you can use the following command:
echo. > example.txt
This command uses the echo
command with an empty string (echo.
) and redirects the output to a file (>
). The result is an empty text file named example.txt
.
If you want to create a file with some content, you can do the following:
echo This is the content of the file > example.txt
This command will create a file named example.txt
with the specified content.
To create a new folder, you can use the mkdir
command. For example, to create a folder named NewFolder
, use the following command:
mkdir NewFolder
This command will create a new folder named NewFolder
in the current working directory.
If you want to create a folder within another folder, you can specify the full path or use the cd
(change directory) command to navigate to the desired location. For example:
mkdir ParentFolder
cd ParentFolder
mkdir ChildFolder
This sequence of commands creates a folder named ParentFolder
, navigates into that folder, and then creates a folder named ChildFolder
within it.
Remember to replace file and folder names with your desired names. Additionally, be cautious when using commands like mkdir
to avoid unintentional overwriting or deletion of files and folders.
To copy a file to another location:
copy sourcefile-name destination
Here is a text file in my desktop folder of C drive, I want to copy that to the world folder.
Here is how I did that
To move or rename a file:
move sourcefile destination
To delete a file:
del filename
To view detailed information about your system:
systeminfo
To see a list of running processes:
tasklist
To display the IP configuration for all network interfaces:
ipconfig
To test network connectivity to a specific address:
ping destination
These are just a few basic commands to get you started. Explore the repository to find more advanced commands and techniques!