command console tutorial n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Command Console Tutorial PowerPoint Presentation
Download Presentation
Command Console Tutorial

Loading in 2 Seconds...

  share
play fullscreen
1 / 34
emiko

Command Console Tutorial - PowerPoint PPT Presentation

87 Views
Download Presentation
Command Console Tutorial
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Command Console Tutorial BCIS 3680 Enterprise Programming

  2. Overview • Working in Command Console • Navigation • Working directory • Listing contents of directory • Special “directories” • Running Java Commands in Console • Difference between system and Java commands • Using PATH • Showing File Extensions

  3. Starting a Command Console

  4. Command Prompt

  5. Alternative Way to Start Console • Click Windows Start menu. • Select Run… • In the ensuing dialog box, type cmd • Click OK or press Enter.

  6. Working Directory • When the console opens, you’re at a certain location in the file system. • The default is the Windows home folder for the current user. In Windows XP, it’s C:\Documents and Settings\<username>. In Windows 7 and 8, it’s C:\Uers\<username>. • From here, you may move away to other locations. • At any point of time, you are “parked” somewhere in the file system. The current location you’re at is your working directory.

  7. GUI View of My Working Directory • What is a folder in Windows graphic user interface (GUI) is called a directory in the terminology of command console. • Similarly, subfolder = subdirectory.

  8. Navigation: Moving to Another Drive • To move a different drive, simply type the drive letter, followed by a semicolon, at the command prompt. • Press Enter and you’re at the root of that drive. • My working directory is the root of F: now.

  9. Navigation: Moving to Another Folder • To move to another folder, use the CD (change directory) command. • In Windows, the commands are not case-sensitive. So CD and cd are the same command.

  10. Navigation: Moving to Another Folder • Again, note that as I cd into the new location, the path in front of the prompt (>) changes to reflect my new working directory.

  11. Viewing Contents of a Directory • To see what are the contents inside a directory, use the DIR (short for “directory”) command.

  12. Special “Subdirectories” • In every directory, there are two special “subdirecotries”: • A single dot refers to the current directory, i.e., working directory. • Double dots refer to the immediate parent directory of the working directory. • Therefore, in the example below, if you issue the command dir ., the same output will be repeated. • If you issue cd .., your working directory will changed to F:.

  13. Drilling Down inside a Directory • In the DIR output, <DIR> indicates a subdirectory (notice that both the . and .. “subdirectories” are marked as <DIR>. • In this example, hello also is a subdirectory of the working directory. • Use CD to move your working directory into the hello subdirectory. • Use DIR to list the contents of hello. • Repeat this procedure to “drill down” through the subdirectories of a directory. • Whenever you need to go back up one level, use the cd.. command.

  14. Drilling Down inside a Directory

  15. Shortcuts for CD Command • If there are many levels of subdirectories, it would be too cumbersome to run cd.. repeatedly, each issuance of the command bringing you up only to the immediate parent of the current working directory. • You may combine the double dots as part of a relative path to the subdirectory you want to go to. • Use a pair of double dots for each level above the subdirectory you’re starting out from. • Separate two pairs of double dots with a backslash (\). • Once you reach a point where the parent of the destination folder, write out names of each directory in that branch. • Use the entire string as the “argument” of the cd command.

  16. Navigation: CD with Relative Path

  17. Navigation: CD with Relative Path

  18. Navigation: CD with Absolute Path • The alternative solution is to type the absolute path (starting with the drive letter and spell out all subdirectory names).

  19. Beeline to Root of Drive • Use backslash as the argument of CD command and it moves you directly to the root of the drive.

  20. Other Useful Commands • MD <new subdirectory name> • Also MKDIR • Create a new subdirectory • RMDIR <subdirectory to remove> • Remove a subdirectory • DEL <subdirectory> does not remove the subdirectory. It only deletes all files in the subdirectory • DEL <file name> • Delete a file • TYPE <file name> • Output a file to the console • CLS • Clear the display of console

  21. Running Non-System Commands • For system commands such as CD or DIR, the command console knows where to find their executable files and run them. • But if a program is not a native system file, the console assumes that it is inside the working directory. If it indeed finds the executable there, it runs it. If not, it throws in the towel and complains.

  22. Running Java Commands • Java is not a Windows system application. So without assistance, the command console doesn’t know where java.exe or javac.exe is.

  23. PATH Environment Variable • The PATH variable contains a number of absolute paths, separated by semicolons. • When Windows is installed, it adds quite some items in this variable. • You can add to this variable absolute paths to non-system programs you want to run in command console. • Do NOT add specific file name, only the path to the directory that contains the file you want to run.

  24. Editing PATH • To edit PATH, right-click the computer icon on the desktop (or the Computer menu item in the Start menu). • Select Properties.

  25. Editing PATH • Alternative, you can start the process by going to Control Panel and clicking System.

  26. System Properties Dialog Box

  27. Find Path in System Variables

  28. Editing Value of Path • To add a new path, first go to the very end of the existing value of Path. • It is very important not to change the current value in any way. Otherwise some of your programs may not work properly. • If you suspect that you may have altered the value inadvertently, simply click Cancel and start over again.

  29. Editing Value of Path • Add a semicolon to the end and then type in (paste in) the new path you’re adding. It’s NOT necessary to add a trailing backslash and/or semicolon. • Click OK to save the new value.

  30. Verifying PATH Changes • To make sure that you have changed the PATH, start a command console and run the PATH command. • The new value should be in the command output. • It may be necessary to restart your computer for the changes to take effect.

  31. Showing File Extensions in Windows 7 • In this course, often we want to show the file extensions (e.g., the .class for source code files) in Windows Explorer. • However, the default Windows behavior is to hide file extensions that it recognizes. • We can change the settings of Windows Explorer.

  32. Showing File Extensions • In Windows Explorer, click Organize (upper-left corner). • In the ensuing drop down menu, click Folder and search options.

  33. Showing File Extensions • In the Folder Options dialog box, clear the checkbox for Hide extensions for known file types. • Click OK to close the dialog box.

  34. Showing File Extensions • Now all file extensions are displayed, whether Windows recognizes them or not.