This tutorial is for Windows PC users who want to learn basic disk concepts as well as enter commands at the command prompt. These concepts and commands originated with the DOS operating system in the first PCs and were carried over to Windows.
Programmers and power users often use the command line to copy, rename and manage files and folders. Commands typed on a command line often enable the user to perform an operation much faster than using a graphics-based application such as Windows Explorer.
Where Is the Windows Command Line?
To obtain the command line in Windows, look for the Command Prompt in the Start menu. It can be found in the Accessories folder in the Programs section. To exit the command line, type exit
and press Enter.
HOW A DISK IS ORGANIZED
DOS/Windows disk drives are identified by a letter and colon. The storage drive is C: because the floppy drives used to be A: and B:. Additional storage drives and CD/DVD drives are named D:, E: and so on.
You may find an old PC with a floppy disk, which will be the A: drive. The second floppy used to be B:, which is why the first storage drive was C: when hard disks first became available in the 1980s.
Storage drives are further divided into simulated file folders. Each of them is called a "folder" or "directory," and its size is limited only by the space left on the disk.
Your software package's install program creates the application folder and copies the appropriate files into it. However, there are times when you may want to organize your own data by creating your own folders and moving data files among them.
A disk is organized in a hierarchical fashion like an organization chart. The top of the hierarchy is the root folder (directory). In an old DOS computer, there were configuration files in the root folder. In a Windows computer, there are only hidden files, and the root folder serves as a starting point for all the other folders on the disk. USB flash drives may also contain folders.
Folder or Directory - Which?
The Internet is based on Unix, which uses the term "directory" rather than "folder." Today, the two terms are used interchangeably. In fact, although the Mac popularized the term "folder," when the original Mac OS was replaced with the Unix-based Mac OS X operating system, even Mac users began to say "directory." The result... a folder is a directory is a folder.
When working with files or executing programs from the command line, and even in Windows Explorer, your reference point is always the "current," "working" or "default" drive and folder.
THE COMMAND PROMPT
The command line is ready to accept a command when the "prompt" is displayed. The prompt also indicates where the action takes place; for example, the following prompt refers to the C drive and root folder:
The C: is drive C. The backslash (\) means root folder, and the greater-than symbol (>) terminates the prompt. If you were in the DATA folder, the prompt would be C:\DATA>.
Assume you have the following folders on your hard disk:
If you are in C:\DATA> now, and you want to go to C:\WORDS>, you would type:
C:\DATA>cd \words change to WORDS
C:\WORDS> prompt has changed
cd \words means
CHANGE TO ROOT then WORDS
cd \ words
Switch back to the root folder by typing:
C:\WORDS>cd \ change to root
C:\> prompt has changed
Subfolders (subdirectories) are subordinate to the main folders.
To switch from one drive to another, type the drive letter and colon as follows. Be sure to include the colon.
C:\>d: change from C to D
D:\> prompt has changed
Commands are run by typing them on the command line and pressing enter. Commands generally require one or more parameters after the command verb; however, there are exceptions:
dir list file names
cls clear screen
When wild card symbols are added to the DIR command, it becomes selective as in the following examples:
dir *gif list all GIF file names
dir abc.* list all files named ABC
More examples of how commands are used:
format d: format the D: drive
ren a.txt b.txt rename A.TXT to B.TXT
copy a.txt d:\ copy file to root of D:
MORE DETAILS, COMMANDS AND TOPICS
To learn more about switching between folders on the command line, see cmd folders
. Following are common command line operations:
Dir Command Options
Copy Files and Folders
Create and Remove Folders
View/Change File Permissions
Create a Batch File
See batch file abc's
Clear the Screen
File Names and Extensions
See file name
File Selection Using Wild Cards
See wild cards
End of CMD ABC's
You can perform many operations and save time using the command line in Windows. Good luck!