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. The disadvantage is that it is less user-friendly.
You will need the command prompt in COS to compile and execute your Java programs. Learning the Command Prompt also provides a gradual transition to Unix and Linux systems, which are prevalent in science, engineering, and industry. The Command Prompt shows up as a black terminal window. The boldface type below that follows the command prompt is what you should type as you work through this tutorial. Windows does not care if you use upper or lower case.
That means that command cd is the same as CD. It also means that, in Windows, file HelloWorld. This is NOT true in the system to which you will be submitting your files. Be very careful!!! In any dialog box, you can use the Tab key to cycle through all of the fields and buttons.
Consider for example the following dialog from the Notepad program. Type the Fi n d what entry, then hit the Tab key to quickly get to the Re p lace with field. The Tab key is particularly handy for dialogs that have many text fields. When you use the Tab key to cycle through the dialog box, observe how the focus shifts from one field to the next.
A text field with focus has a blinking cursor. A button with focus has a dotted rectangle around the button label. The focus tells you which part of the dialog box receives keyboard input. For example, if a button or checkbox has focus, then hitting the Space bar is the same as clicking it with the mouse. If an item name has an underlined letter such as Match c ase , then you can type Alt together with the underlined letter to reach it quickly. Finally, most dialogs respond to two special keys.
Typing Enter is the same as clicking the Ok button. You know know the most common keyboard shortcuts. After a short amount of practice, you will probably agree that the keyboard is mightier than the mouse for many routine tasks.
Whether hard or floppy, a computer disk drive essentially contains a round, flat, object, and it reads its surface with a magnetic or optical head. In addition to the disk drives that are physically present in a computer, there may be several mapped drives that are provided by the network server.
These are not actual drives at all, but look to the operating system and to you as though they are. The drives that hold the disks are named by a letter followed by a colon :.
The names a: and perhaps b: are the floppy drives. The names c: and d: are usually used to name hard disk drives in that same computer. Higher letters like j: , k: , There are many ways to find drives and view their contents using Windows. The program we will use is called Windows Explorer.
This is not the same program as Internet Explorer , Microsoft's web browser. The Windows Explorer program explores the file system, not the internet. The look of the Explorer has changed greatly with different versions of Windows, and it can also be configured in many ways.
Don't worry if your Explorer window looks quite different from this screen shot. Each drive contains files and directories also called folders. In the Explorer program, click on a drive to see the files and folders. The files are depicted with an icon that looks like a file folder. Files have different icons that depend on their type.
A typical hard disk holds thousands of files. It is therefore essential to organize your files on the disk. As you accumulate files on a disk, you store them in groups by creating directories. Directories are also called file folders. Generally, programmers prefer the term "directory", and we will use that term in this tutorial.
Each directory can contain any number of files and other directories called subdirectories. This arrangement is known as a hierarchical or treelike directory structure. To visualize the hierarchy of directories, it is best to look at the tree view to the left of the Explorer window. This indicates whether the next level of the directory hierarchy is hidden or expanded. On each drive, the hierachy starts with the root directory.
The sequence of subdirectories from the root to a given file or directory is called the path. For this part of the tutorial, you need to find a directory into which you are allowed to place files and folders. If you work in a computer lab, you will need to find out the name of the directory that was created for your use. View your directory in the Explorer program. This command places a folder icon inside the directory and gives it the temporary name New Folder. It also leaves the cursor in the name field, allowing you to change it immediately.
Hit Delete to erase the name, and give it a new name. A good choice for a name is your own name, contracted to a single word without spaces such as joe or jqsmith. If you use your own computer, create this directory now. From now on, place all files in this directory.
There are a few other special characters that you can use, but the details depend on whether the drive is a local drive or a networked drive.
It is best to avoid file names with exotic symbols such as! You can use spaces in file names, but programmers rarely do that, because spaces in file names create problems when you use a command shell. Both uppercase and lowercase letters are permitted in file and directory names, but Windows will not distinguish between names that differ only in the case of the letters. Type a few words. You will get the Windows file dialog.
Also, the current directory is likely to be wrong. Fortunately, in most versions of Windows, the useless default is also highlighted, so you can overtype it. Actually, type the name of your personal directory. Type the letters s l o w l y and pay close attention to the entry field. You will see that a small menu below the entry field is filled with the names that match what you have typed at this point.
This feature is a great time-saver. As soon as you see the name that matches what you want to type, hit the Down arrow button to select it. Presenting all choices that match the typed letters is called incremental search. Clearly, incremental search is a marvelous convenience because it minimizes the number of keystrokes. Be sure to supply the extension. That extension signifies that the file is a text document. Depending on the configuration of Windows, the extension. By default, Windows hides the extensions, presumably because naive users are confused about file names such as letter to aunt tilly.
As a programmer, you don't want the operating system to hide information from you. Windows uses the file extension to figure out what to do with the file when you double-click on it. Double-clicking on a. Double-clicking on a program file with extension. You can find out which program corresponds to a particular extension. You get a list of all file types that are registered with Windows. You or a program that you install can modify these associations. Items such as file and directory icons in the Explorer display have context menus that contains commands directly related to the item.
This menu can be displayed by clicking on the object's icon with the right mouse button. One of the most useful entries in the context menu of a file is Rename. To rename a file, right-click on the file, select Rename and type the new file name. Files and directories often need to be copied. There are two methods for copying files with the Explorer program. The most intuitive method is drag-and-drop : select a file with the mouse, drag it to another directory, and drop it.
If you hold down the Ctrl key while dragging the file, it is copied, not moved. With some manual dexterity, you can also drag a group of files. To select more than one file, depress the Ctrl button and click on all files in the group.
Depress the Shift button and use the Up and Down arrow keys to select a contiguous set of files. The difficulty with drag-and-drop is that both the source and target directory need to be on the desktop. You can overcome that problem by cutting and pasting files. Select the files you want to move or copy. Computers are fairly reliable, but their parts do have a finite lifetime. Also, important files can sometimes be destroyed by careless computer users.
You should make it a habit to back up all important files. Your instructor will likely not accept "The computer ate my file! In ancient times, floppy disks were used to back up data. However, floppy disks are actually more fragile than hard disks.
Also, the disk drive alignments of different computers can vary, sometimes so much so that it becomes impossible to read a floppy disk that was written on another computer. It is best if you use floppy disks as a matter of last resort. On your own computer, the most convenient backup method as of is a CD burner. Windows XP has a rudimentary feature set for burning CDs. You can insert a blank CD, drag files onto it, and burn the CD.
However, some computer manufacturers preload software that offers a different interface to the CD burner, and older versions of Windows require a separate programs for CD burning. Since the details vary widely, we cannot review the process in this tutorial. The best method for backing up your work in a computer lab is an online service such as Yahoo Briefcase.
You can save files on an external server and load them back either onto the same computer in case you need to restore a lost or corrupted file , or onto another computer in case you need to move your work between your lab and home computers. The command shell window appears:. You will see a listing of the files and directories in the current directory. As always, replace yourname with your personal directory name.
If your directory is contained in a drive other than C:, you first need to switch to the other drive by typing the drive letter followed by Enter , for example. Typing cd plus a path c hanges the d irectory to the given path. By default this control character is configured to be the tab key for both file and directory names, although they can be different. To change this control character, run regedit.
Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer. Set these values to that of the control character you wish to use. See virtual key codes for a complete list. To disable a particular completion character in the registry, use the value for space 0x20 as it is not a valid control character. You can also enable or disable file and directory name completion per instance of a Command shell by running cmd.
User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings. To find information about a specific command, in the following A-Z menu, select the letter that the command starts with, and then select the command name.
Skip to main content. This browser is no longer supported.
0コメント