8
DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

Embed Size (px)

Citation preview

Page 1: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

DOS and the Command Line

CS 21a: Introduction to Computing I

First Semester, 2013-2014

Page 2: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

What is DOS?

►Disk Operating System►Enables the user to organise data

files, load and execute (run) program files

►Entirely text-based, command-line system where the user can type in commands from the keyboard

Page 3: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

Launching the Command Line

►From the Start menu, choose Run►Type command or cmd and click OK ►Or: download cmdhere.bat from the

course website, place in a folder, and then double-click

►To close the command line, type exit and press <enter>

Page 4: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

A Word of Warning

►With DOS comes power; you can very easily mess up your system if you use powerful commands in the wrong way

►Be EXTREMELY careful when using these commands:► format► fdisk► del / deltree

Page 5: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

Useful DOS Commands

► dir – display current directory► use /w or /p if directory has a lot of files► ? stands for a single digit or letter► * stands for a combination of digits and/or letters

► cd <folder-name> – change current directory ► . – current directory► .. – parent directory

► md <folder-name> - make new folder► copy <source-file> <dest-file> - copies

the <source file> to a file called <dest-file>► del <file.ext> - deletes a file

Page 6: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

Java Commands

► javac <java-source-file> - compile a java program

► java <java-class-name> - execute a java program

► javadoc <java-source-file> - generate java documentation

► javap <java-class-name> - print information about the java class

Page 7: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

Java Commands

► set path=<java bin location>;%PATH% - adds the JDK system directory to the existing path variablesset path=C:\Program Files\Java\jdk1.6.0_20\bin

► set classpath=<folder-of-class-files> - informs Java where class files are located

► (Note: path should include the location of the Java executables; automatically set by cmdhere.bat)

Page 8: DOS and the Command Line CS 21a: Introduction to Computing I First Semester, 2013-2014

DOS Exercise

►Open a command line terminal window►Create and compile the Hello.java

program on your desktop►Create a "cs21a" subdirectory under C:\Users\User\Desktop

►Copy Hello.java and Hello.class to the "cs21a" directory by using JUST 1 copy command

►Delete the Hello.java and Hello.class files on your desktop