In our last article we went through an Introduction to CMD, its benefits and limitations.
In this article we will go through the basic CMD commands.
So lets get started !
NOTE : Click/Open image to view it properly and understand the working of commands.
OPENING CMD AND HELP OPTION
First thing first! How to open command prompt (CMD)? Open start menu and search ‘cmd’ and it will show up ‘cmd.exe’ open it, as simple as that.
If a user wants to see the option/commands available in CMD just type [box] help[/box] it will show up the list of commands available.
If you want to look up further for the options available for a specific command from the list
Type [box]Syntax: help [Command name] or [Command name] /?[/box]
Both give the same result.
CHANGING INTERFACE
User have freedom to change user interface (UI) of CMD, one can change font color, the background color. Just open CMD and type [box]color /?[/box] it will show up the color options available for font and background.
You can change UI by typing [box]Syntax: color [Background color][Font color]
for ‘Red background’ with ‘Bright White font’
color 4F[/box]
(4 specifies the Red background and F specifies the font color).
CHANGING DIRECTORY IN CMD
Let us step up and see how to look up the files present in a directory and change directories using CMD.
As CMD starts, the default path it will read is the folder location of current logged in username
[box]Default path CMD reads:
[C: Users’logged in username’]
In snip given below it reads my username as rajat[/box]
To view the files and folders present in there type [box]dir
which stands for directory[/box]
If you want to go to another folder present in the current directory type [box]Syntax: cd [Folder name]
cd stands for change directory
cd Documents
changes location to [C:UsersrajatDocuments][/box]
CREATING A FOLDER/FILE
Let us get started working with files and folders and basics like creating, copying, renaming, deleting files.
To create a folder we use [box]Syntax: mkdir [Folder name]
mkdir stands for make directory[/box]
Let us see an example by making a folder name Czar_Securities.
We will use command [box]mkdir Czar_Securities[/box]
DELETING A FOLDER/FILE
We have already learned how to create a folder, now let us see command to delete a file. We use command [box]Syntax: del [file name][/box]
Let us take an example, we use command [box]del test.txt[/box]
READING/DISPLAYING A FILE
What if we want to open a file? Simple! We use command [box]Syntax: type [file name][/box]
Taking an example, using command [box]type test.txt[/box]
COPYING A FILE/FOLDER
Let us see how we can copy file from one folder to another. We use command [box]Syntax: copy [file name] [destination][/box]
CMD should be pointing at the location where file is located.
Looking at an example, using command [box]copy notepad.txt C:usersrajatDesktoptesting[/box]
RENAMING A FILE/FOLDER
Let us rename a file and see command to be used. We use [box]Syntax: rename [current name] [new name][/box]
taking an example, [box]renaming ‘test.txt’ to ‘testALPHA.txt’
Using command: rename test.txt testALPHA.txt[/box]
In our next article we will be looking up at commands related to networking, looking up at IP address and much more interesting stuff.
So keep tuned up for more.