What is Command Prompt?
The Command Prompt program allows you to work in an environment that looks more like a traditional operating system as opposed to the icon based Windows environment. In Command Prompt, you will use your keyboard. You won’t use your mouse at all. Command Prompt works at a lower level than Windows. This means that you will have more control over the machine.

# dir: To view the contents of a directory, type dir. This command will list all the files and directories within the current directory. It is analogous to clicking on a Windows folder to see what’s inside.

C:\> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\

10/26/2004 01:36 PM 0 AUTOEXEC.BAT
10/26/2004 01:36 PM 0 CONFIG.SYS
02/10/2005 01:36 PM 126 HelloWorld.java
12/09/2004 12:11 AM DIR Documents and Settings
02/10/2005 08:59 PM DIR introcs
11/02/2004 08:31 PM DIR j2sdk1.4.2_06
12/29/2004 07:15 PM DIR Program Files
01/13/2005 07:33 AM DIR WINDOWS
3 File(s) 126 bytes
5 Dir(s) 32,551,940,096 bytes free

There are 7 items in this directory. Some of them are files, like HelloWorld.java. Others are directories, like introcs.

# cd: It is frequently useful to know in which directory you are currently working. In order to find out, type cd at the command prompt.

C:\> cd
C:\

To change directories, use the cd command with the name of a directory.

C:\> cd introcs

Now, the command prompt will be:

C:\introcs>

To see what is in this directory type:

C:\introcs> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\introcs

02/10/2005 08:59 PM DIR .
02/10/2005 08:59 PM DIR ..
02/03/2005 11:53 PM 126 HelloWorld.java
01/17/2005 01:16 AM 256 readme.txt
2 File(s) 382 bytes
2 Dir(s)

To return to the previous directory, use the cd command, but this time followed by a space and two periods.

C:\introcs> cd ..
C:\>

# mkdir: To create a new directory, use the command mkdir. The following command creates a directory named hello, which you can use to to store all of your files associated with the Hello World assignment.

C:\introcs> mkdir hello

To see that it actually worked, use the dir command.

C:\introcs> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\introcs

02/10/2005 08:59 PM DIR .
02/10/2005 08:59 PM DIR ..
02/11/2005 02:53 PM DIR hello
02/03/2005 11:53 PM 126 HelloWorld.java
01/17/2005 01:16 AM 256 readme.txt
2 File(s) 382 bytes
3 Dir(s)

# move: Now, move the two files HelloWorld.java and readme.txt into the hello directory using the move command.

C:\introcs> move HelloWorld.java hello
C:\introcs> move readme.txt hello
C:\introcs> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\introcs

02/10/2005 08:59 PM DIR .
02/10/2005 08:59 PM DIR ..
02/11/2005 02:53 PM DIR hello
0 File(s) 0 bytes
3 Dir(s)

The two files are no longer visible from the current directory.

# copy: To make a copy of a file, use the copy command. The following command creates a backup copy of our HelloWorld.java program. This is especially useful when you modify a working program, but might want to revert back to the original version if your modifications don’t succeed.

C:\introcs\hello> copy HelloWorld.java HelloWorld.bak
C:\introcs\hello> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\introcs\hello

02/10/2005 08:59 PM DIR .
02/10/2005 08:59 PM DIR ..
02/03/2005 11:53 PM 126 HelloWorld.java
01/17/2005 01:16 AM 256 readme.txt
2 File(s) 382 bytes
3 Dir(s)

# del: Subsequently, you might want to clean up useless files. The del command deletes a file.

C:\introcs\hello> del HelloWorld.bak
C:\introcs\hello> dir
Volume in drive C has no label.
Volume Serial Number is C8C7-BDCD

Directory of C:\introcs

02/10/2005 08:59 PM DIR .
02/10/2005 08:59 PM DIR ..
02/03/2005 11:53 PM 126 HelloWorld.java
01/17/2005 01:16 AM 256 readme.txt
2 File(s) 382 bytes
3 Dir(s)

In this way you get the knowledge of basic command prompt.