Top Banner
COMP 110/401 WINDOWS COMMAND INTERPRETER Instructor: Prasun Dewan (FB 150, [email protected])
91

Comp 110/401 Windows Command Interpreter

Feb 23, 2016

Download

Documents

Misu

Comp 110/401 Windows Command Interpreter. Instructor: Prasun Dewan (FB 150, [email protected]). Windows Command Interpreter. Command Interpreter?. Interprets Command Lines. Provides alternative to (OS and Application) GUIs. GUI Alternative. GUI. Command Interpreter. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Slide 1

Comp 110/401 Windows Command InterpreterInstructor: Prasun Dewan (FB 150, [email protected])

#Windows Command Interpreter

#Command Interpreter?Interprets Command LinesProvides alternative to (OS and Application) GUIs

#

GUI AlternativeGUICommand Interpreter#Why Command Interpreter?Command lines may be preferred to GUIs in some situations and by some peopleSome applications and OSs do not come with GUIs and must be used through command interpreterjava, javac, kindlegenSome think you do not know computers if you do not understand a command interpreter#Command Line Syntaxjavac -d bin src\warmup\AGreeter.javacd warmup

parametersCommand = Command LineCommand = Command Name#Classifying Command (Names)Execute code built-into OSInternalcdExecute some application program installed on top of OSExternaljavacCommand interpreter does not know about external command names; so how does it run and interpret them?#Running External Command: Tokenization and Two-Stage Command InterpretationName of an executable filejavac -d bin src\warmup\AGreeter.javaA sequence of parametersCommand interpreter separates the command line into a sequence of units or tokens divided by separators ( spaces and tabs)It treats the first token as the name of an executable file, finds it and executes itIt passes the remaining tokens to the newly executed program, which then interprets themOne or more of the parameters may be file (and folder) names#Command Interpreter Searching for Executable Command: First Interpretation StageIt treats the first token as the name of an executable file, finds it and executes it

#External Program Interpreting Parameters: Second Interpretation StageIt passes the remaining tokens to the newly executed program, which then interprets it

#TokenizationD:\Program Files\Java\jdk1.7.0_11\bin\javac -d bin src\warmup\AGreeter.javaFirst token = command-name

#"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaUsing Quotes for Tokens with SpacesFirst token = command-name

#How to Name Files (and Folders)One or more of the parameters may be file (and folder) namesFiles and folders are both often called files"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaFile Names#"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaRelative/Partial vs. Absolute/Full NamesRelative nameAbsolute nameShorter names but more complicated naming schemeLonger names but simpler naming scheme#Local Name of File/folderD:\Program Files\Java\jdk1.7.0_11\bin\javac" d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaLocal NameA file or folder is always created within some parent folder to create a hierarchical file systemThe name given within the parent folder is called the local name of the file/folder#Absolute/Full NameNames are separated by \ Gives the full path name, with each name taking isone level down in the folder hierarchyD:\Program Files\Java\jdk1.7.0_11\bin\javac" d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaLocal name of the target flile(folder)Preceded by Local name of its parentPreceded by Local name of its parents parentDrive name#D:\dewan_backup\Java\WarmupProject\binTraversing Down the HierarchyD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProject#Reducing Effort to Enter Absolute NamesCopy Absolute Name from GUI and Paste into Command LineEdit Previously Entered Command Line#Copy Absolute Name from Folder Browser GUI

Click mouse to get full nameCTRL + C#Paste into Command Line

Top border, Right menuEditPaste#Text Pasted at Current Cursor Position

#

Use left and right arrow Keys to change Cursor PositionCursor at start of line#

Can insert or Delete at Cursor Point inserted at start of line#Relative NameRelative to current directory (or folder)Relative to folders in System Path#Current DirectoryEach command interpreter is associated with a current directory or folder name, parts of the Windows promptBuild-in cd command can be used to change the current directory to some other directory on the same driveInitial folder is home directory of logged in userBuild-in drive command can be used to change drive

#Changing DrivesCommand = Drive Name:Case does not matter in drive file names on Windows

#Changing Folder within Drive: CD Commandcd Current directory

#Name Relative to Current DirectoryRelative to current directory (or folder)Given current directory with absolute name: a

Relative name: r =a file with absolute name: a\r#Relative NameRelative to single current directory (or folder)Relative to multiple folders in System PathD:\Program Files\Java\jdk1.7.0_11\bin\javac" d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaCan be used in both command names and file parametersUsed only in command names#Setting System Path: System Properties

#Setting System Path: Advanced System Settings

#Setting System Path: Environment Variables

#Select Path System: Select Path Variable and Edit

#

Select Path System: Add Folder to Path after Semicolon

D:\Program Files\Java\jdk1.7.0_11\bin\javacNo need for quotes because of ; #Reusing Commands: Command History

Want to execute (portion of) a command in historyUse up and down arrow keys to reuse commands in history#Reusing Commands: Up Arrow Displays Previous Editable Command First Up-Arrow shows last command

#Reusing Commands: Up Arrow Displays Previous Editable Command Second Up Arrow shows second last command

#Reusing Commands: Enter Executes (Possibly Edited) Previous CommandEnter

Could have edited commandHistory particularly useful if absolute files names entered#D:\dewan_backup\Java\WarmupProject\binMore on Names: Traversing Down the HierarchyD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProject#..\..\binTraversing Up (and Down) the HierarchyD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProjectCurrent Directory..Name denoting the parentTarget Directory#

Use of ..#.Naming Current DirectoryD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProjectCurrent DirectoryThe current directoryA la this in Java#Use of .

Current directory#NAMING Root Folder on Drive

D:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProject\D:Changes drive, not directory within drive#Completing File Name TokenHit tab

#Completing File Name TokenHit tab to complete token if known to application cmpletingShould choose unique prefix

#Saving Interaction

Input#Marking Text

#Marking Text

Drag mouse to select text#Copy Text

This text can now be pasted anywhere#

Output Redirection

InputEchoed Input of Ca va commandCommand > FileOutput of Command goes to File rather than the command window

#

Input Redirection

Echoed input from fileInput for Buon Girono CommandCommand < FileInput of Command comes from File rather than the command window#

PipeCommand1 | Command2Output of Command1 becomes input of Command2#

GUI Alternative: Dir Command#

GUI Alternative: Type Command#

GUI Alternative: Erase Command#

GUI Alternative: Mkdir Command#

WildCard: *#

WildCard: *#

Partial WildCard and Find (Piped)#Ipconfig

#PING

#Sort (Piped)

#Find(Piped)

#Starting Separate Command Interpreter

#Extra Slides#Starting Another Command Interpreter in Same Window and Exit

#Command Interpreter?Interprets Command LinesProvides alternative to (OS and Application) GUIs

#Why Command InterpreterCommand lines may be preferred to GUIsSome applications and OSs do not come with GUIs and must be used through command interpreterjava, javac, kindlegen#GUI AlternativeGUICommand InterpreterCommand interpreters came first

#Command Name Relative to Folder in Path

#Advance

#Relative NameRelative to current directory (or folder)Relative to folders in System PathD:\Program Files\Java\jdk1.7.0_11\bin\javac" d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaCan used in both command names and file parametersUsed only in command names#Relative Name: Going BackwardA .. After some directory D refers to the parent of the DGiven current directory with absolute name: dRelative name: ... denotes a file with absolute name: d\fRelative name: src\warmup\AGreeter.java denotes a file with absolute name D:\dewan_backup\Java\WarmupProject>\ src\warmup\AGreeter.java Given current directory with absolute name: D:\dewan_backup\Java\WarmupProject>"

#Relative to current directory (or folder)Given current directory with absolute name: dRelative name: f denotes a file with absolute name: d\fRelative name: src\warmup\AGreeter.java denotes a file with absolute name D:\dewan_backup\Java\WarmupProject>\ src\warmup\AGreeter.java Given current directory with absolute name: D:\dewan_backup\Java\WarmupProject>"#Relative/Partial vs. Absolute/Full Namesjavac -d bin src\warmup\AGreeter.javaD:\dewan_backup\Java\WarmupProject\src\warmup>"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaD:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.java#TokenizationD:\dewan_backup\Java\WarmupProject\src\warmup>"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.java

D:\dewan_backup\Java\WarmupProject\src\warmup>D:\Program Files\Java\jdk1.7.0_11\bin\javac -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaFirst token = command-name#Using Quotes to Separate TokensD:\dewan_backup\Java\WarmupProject\src\warmup>"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.java

First token = command-name#GUI AlternativeGUICommand InterpreterCommand interpreters came first

#TokenizationD:\dewan_backup\Java\WarmupProject>D:\Program Files\Java\jdk1.7.0_11\bin\javac - d bin src\warmup\AGreeter.javaFirst token = command-name

#Relative Name: Going ForwardRelative to current directory (or folder)Given current directory with absolute name: dRelative name: f denotes a file with absolute name: d\fRelative name: src\warmup\AGreeter.java denotes a file with absolute name D:\dewan_backup\Java\WarmupProject>\ src\warmup\AGreeter.java Given current directory with absolute name: D:\dewan_backup\Java\WarmupProject>#GUI AlternativeGUICommand InterpreterCommand interpreters came first

#Classifying Command-NamesIdentify code built-into OSInternalcdIdentify some application program installed on top of OSExternaljavacCommand interpreter does not know about external command names; so how does it run and interpret them?#D:\dewan_backup\Java\WarmupProject\src\warmup>"D:\Program Files\Java\jdk1.7.0_11\bin\javac" -d D:\dewan_backup\Java\WarmupProject\bin AGreeter.javaRelative/Partial vs. Absolute/Full NamesRelative nameAbsolute nameShorter names but more complicated naming schemeLonger names and simpler naming scheme#How to Name Files (and Folders)javac -d bin src\warmup\AGreeter.javaOne or more of the parameters may be file (and folder) namesFile namesFiles and folders are both often called files#File/folder Hierarchies and Local NamesD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProject#Completing File NameEnter

Could have edited commandHistory particularly useful if absolute files names entered#Redirecting Output

Echoed input

InputCommand < FileInput of Command comes fromFile rather than the command window#..Traversing Up (and Down) the HierarchyD:dewan_backupJavasrcwarmupAGreeter.javaAGreeter.classwarmupbinWarmupProject#Output Redirection

InputEchoed InputCommand > FileOutput of Command goes to File rather than the command window

#Input Redirection

Echoed input from file

InputCommand < FileInput of Command comes from file rather than the command window#