Before Windows, Microsoft released a text-based operating system called MS-DOS. While DOS has largely expired, the usefulness of typing commands to the operating system remains. Not everything in your OS has a pretty clickable icon, and so the command line can grant you access to powerful features not used by casual users. The commands used to interact with Windows are generally the same as those that were used by MS-DOS (though more and more Unix commands are gradually being supported).
In order to type commands, you need to first open the command prompt: Start -> Programs -> Accessories -> Command Prompt. This will open a new black window with a command prompt that shows the path to your current location in the computer's directory structure. It should look something like this:
C:\Documents and Settings\Zach>
(An alternative method is: Start -> Run..., and then type cmd
and hit enter.)
dir
dir
command (short for directory listing) will print a list of all files that are in the current directory. The information displayed includes each file's name, when it was last edited, and its file size. Listings that contain <DIR>
(rather than a file size) are sub-directories (folders) of the current directory.
cd
cd
. You must also specify the name of the subdirectory you want to move into. Example:
C:\Documents and Settings\Zach>cd Desktop C:\Documents and Settings\Zach\Desktop>This moves you down one level. To move up a level, use
..
to stand for "the parent directory". Example:
C:\Documents and Settings\Zach\Desktop>cd .. C:\Documents and Settings\Zach>
You can combine these to form longer path names relative to your current location, or you can use absolute (fully-qualified) names that start with a drive letter. Example:
C:\Documents and Settings\Zach>cd ..\..\windows C:\WINDOWS>cd "C:\Documents and Settings\Zach" C:\Documents and Settings\Zach>(Depending on your system, you may have to put "quotes" around any path name that includes spaces.)
C:\Documents and Settings\Zach>d: D:\>c: C:\Documents and Settings\Zach>
Once you're in the right location, you can manipulate your files using commands such as java
and javac
.
These are only the barest of DOS commands. To learn what other common commands exist, type help
. To learn more about a specific command, type the command name followed by /?, as in: dir /?
You can also learn more by doing a search online for a DOS tutorial.
Some other commands that you should probably learn: cls
, more
, del
, mkdir
, and rename
. (Be careful with del
: deleting files at the command prompt bypasses the Recycle Bin, so deleted files are immediately gone forever.)
Mark
. Now hightlight what you want to copy with the mouse and then right-click again. This copies whatever you highlighted to the system clipboard, and you can paste it from there into another window or application (as with normal pasting).
ctrl-c
)
alt-enter
)
Good luck using the command prompt!