Download presentation
Presentation is loading. Please wait.
Published byMervyn Walton Modified over 9 years ago
1
تهيه كننده : علي برادران هاشمي گارگاه کامپیوتر D isk O perating S ystem
2
2 Many tasks must be done at the command line prompt Some tasks are accomplished easier and faster in DOS Assumption that user “knows” DOS Internet users use command line similar to DOS Career with networks or computer related fields must know command line interface Knowing DOS a must if working for A+ certification. Why learn DOS?
3
3 The Kernel is the central module of an OS. It is the part of the OS that loads first, and it remains in main memory. The kernel of MS-DOS is composed of three files: IO.SYS, MSDOS.SYS, COMMAND.COM The Kernel
4
4 Sets up your computer for all the basic input and output it will need to do. IO.SYS talks with the Computer’s Hardware and interacts with the Keyboard and Mouse through the BIOS. BIOS is a code that controls basic input and output and is stored in the Read Only Memory (ROM). IO.SYS
5
5 Prepares a foundation for DOS, and provides many basic features of the operating system. core of DOS and contains DOS disk- handling programs MSDOS.SYS communicates between the IO.SYS and the COMMAND.COM (next). MSDOS.SYS
6
6 The Command Line Interpreter – The Shell It causes the command prompt to appear C:\> It converts user input into machine language. Basic commands, known as internal commands, are incorporated in the COMMAND.COM which is loaded in Memory. COMMAND.COM
7
7 If COMMAND.COM can not find a command in its internal table of commands, it looks for the command in other files in the following order: 1 st *.COM, 2 nd *.EXE, 3 rd *.BAT (* Denotes a file name) If it can’t find a file with any of these extensions, it searches directories specified in the path in Autoexec.bat for the *.COM, *.EXE, or *.BAT files A command that is executed from a *.COM, *.EXE or *.BAT file on the hard disk or floppy is an external command. Order of Execution
8
8 These exist inside the COMMAND.COM. Internal Commands are located in memory and can be accessed much faster then External Commands. Internal Commands
9
9 These exist outside of the Kernel, normally on a storage device. Because an External Command is located on a Storage Device, the computer must locate the command and load it into memory. SLOW! External Commands
10
10 Whenever a DOS computer boots up, it reads the CONFIG.SYS file (if it exists) and executes any commands in it. It is mainly used to configure interaction with the hardware. You can enter commands that: install drivers for devices, and configure the DOS environment, memory, buffers, etc... CONFIG.SYS
11
11 Stands for AUTOmatically EXECcuted Batch file, the file that DOS automatically executes when a computer boots up. This is a convenient place to put commands you always want to execute automatically at the beginning of a computing session For example, you can set system parameters such as the date and time, the path for searching, run certain programs, etc... AUTOEXEC.BAT
12
12 DEVICE=C:\DOS\HIMEM.SYS DEVICE=C:\EMM386.EXE BUFFERS=20 (mem for info transfer from and to hard drive) FILES=30 (a max of 30 files can be open at the same time) REM DEVICE=C:\DRIVERS\MOUSE.SYS DEVICEHIGH=C:\DRIVERS\MOUSE.SYS DOS=HIGH DOS=UMB REM DOS=HIGH,UMB LASTDRIVE=Z STACKS=9,256 (0 or 8-64, 0 or 32-512) CONFIG.SYS
13
13 PATH=C:\WINDOWS;C:\DOS;C:\WP;C:\ GAMES; PROMPT=$P$G MODE LPT1=COM1 SET TEMP=C:\TEMP REM C:\DRIVERS\MOUSE.COM LOADHIGH C:\DRIVERS\MOUSE.COM WIN AUTOEXEC.BAT
14
14 Manuals often describe directories and file structures in terms of a tree. Trees and Directory Structure Root Directory Subdirectory File However, in a File System, the TREE is inverted Root at top, directories, subdirectories and files below
15
15 A Directory is special kind of file used to organize other files into a hierarchical structure. A directory contains information on files located in them, and perhaps other directories, like a file cabinet that contains files and other folders. Directory lab html Directory
16
16 An absolute pathname always begins with \ (or the drive letter, e.g. "C:\" or "A:\") C:\windows\system The path begins “relative” to where you are in the current (or working) directory. Two dots represent the parent directory “above”, containing your current directory Use..\ to move to the parent directory. Use..\..\ to move to the parent of the parent directory A relative pathname never begins with a \ (or C:\) Absolute Pathnames
17
17 8(characters filename).3(extension) EXTENSIONS (COMMON USE).COMCOMMAND FILES.EXEEXECUTABLE FILES.BATBATCH FILES.INIINITIALIZATION FILES.SYSSYSTEM FILES.TXTTEXT FILES.DATDATA FILES.BAKBACKUP FILE.DLLDYNAMIC LINK LIBRARY DOS FILE NAMING
18
18 ILLEGAL SYMBOLS. :, ; / \ | * ? ILLEGAL NAMES LPT1 LPT2 LPT3 LPT4 COM1 COM2 COM3 COM4 CLOCK$ CON AUX NUL PRN DOS FILE NAMING
19
19 A:Floppy drive B:Floppy drive C:Hard drive D:CD ROM or secondary Hard drive E:ZIP drive, other external drives F:...Network drives Total number of logical drives=23 DOS Drive letters
20
20 /Ahidden files /Pone screen at a time /Wcontents in wide format /Sall subdirectory contents /Blike /P with no header/summary info /Lunsorted, filenames in lower case DIR
21
21 Path to LAB1.doc C:\DATA\CLASSES\HARDWARE\LAB1.D OC DIR STRUCTURE
22
22 CDDISPLAYS CURRENT DIR CD\CHANGES TO THE ROOT DIR CD..MOVES 1 LEVEL UP (parent dir) CD\PATHCHANGES TO PATH CD PATHFROM ROOT TO PATH MD MAKE DIRECTORY RDREMOVE EMPTY DIRECTORY DELTREEDEL DIR AND SUBDIR CHANGE, MAKE, DELETE DIRECTORY
23
23 Locating files with insufficient data *a group of characters ?one single character C:\>DIR *.EXEall files with exe extension C:\>DIR CIS199?.DOC Using ? and ??? Using *.SYS DOS WILDCARDS
24
24 ARCHIVE (+/- A) Files to be backed up. READ-ONLY(+/- R) Files cannot be modified or erased HIDDEN (+/- H) Files will not appear in the directory. SYSTEM (+/- S) DOS system files C:\>DIR /A:R C:\>ATTRIB ATTRIB
25
25 C:\>DIR/A:H or -H(hidden/not hidden files) C:\>DIR/A:S or -S (system/not system files) C:\>DIR/A:D or -D(directory only/file only) C:\>DIR/A:A or -A(files changed/unchanged) C:\>DIR/A:R or -R(read-only/not read only) DIR Using Attributes
26
26 C:\>PROMPT=$P$G $PCurrent drive and path $GGreater than symbol (>) $LLess than symbol (<) $TCurrent time $DCurrent date $QEqual sign (=) $BPipe sign (|) $NDefault drive $VDOS Version $_Enter or line feed COMMAND PROMPT
27
27 1- COMMAND.COM 2- CURRENT DIRECTORY (.COM,.EXE,.BAT) 3- DIRECTORIES SPECIFIED IN THE DOS PATH ERROR MESSAGE Bad command or filename FILE SEARCH PROCEDURES STEPS
28
28 COPY SOURCE\FILENAME DESTINATION COPY CONCommands at the keyboard CTRL + Z or F6 to end DISKCOPYdiskcopy a: a: XCOPYxcopy c:\*.* f:\hw /s/e/v /s copies subdirectories /v verifies data /e copies empty dir /subdir COPY
29
29 RENAMEren test1.txt test2.txt DELETEdel test2.txt HELPdir/? MOVEmove c:\test3.txt c:\data TYPEtype test3.txt Volumelabel OTHER COMMANDS
30
30 C:\>FORMAT A: C:\>FORMAT A:/s ( SYSTEM / BOOTABLE DISK) C:\>SYS A: TRANSFERS SYSTEM FILES TO A: COMMAND.COM MSDOS.SYS (MS DOS) OR IBMBIO.COM(PC DOS) IO.SYS(MS DOS) OR IBMDOS.COM(PC DOS) FORMAT
31
31 TAKES PLACE BEFORE FORMAT MULTIPLE PARTITIONS MAY BE CREATED FOR ADDITIONAL LOGICAL DRIVES and or DIFFERENT OPERATING SYSTEMS CREATES A PARTITION TABLE IDENTIFY THE ACTIVE PRIMARY (BOOTABLE) PARTITION DELETE PARTITION CAN NOT DELETE EXTENDED PARTITION WITH DRIVES DEFINED FDISK (HARD DRIVE)
32
32 FILES WITH FREQUENTLY USED COMMANDS TO WRITE USE EDIT OR NOTEPAD TO EXECUTE TYPE FILENAME EXTENSION MUST BE.BAT TO STOP CTRL+C OR CTRL+BREAK BATCH FILES
33
33 The graphical user interface in Windows operating system uses syntax and rules. Parameter: Information to modify or qualify a command Parameters can be: Variable Fixed Command Syntax
34
34 Fixed parameter: Referred to as a switch. Begins with / (the slash). Slash = forward slash (/). \ = Backslash. Using Fixed Parameters with the DIR Command
35
35 Keyboard: Standard input device Screen: Standard output device Redirection Changes standard I/O e.g. Changes output from monitor to somewhere else (usually file or printer) Redirection syntax command: COMMAND > DESTINATION (Space required on both sides of >) Redirection
36
36 Activity—Redirecting Output to a File Redirecting output to a file Redirecting Output to the Printer Can redirect computer output to a file or to a printer. To redirect to printer need a local printer. Printers device names:PRN, LPT1, LPT2 and sometimes LPT3. Redirection (cont.)
37
37 DOS commands Dir Cd Copy Xcopy Date Time Del MORE CLS Deltree Diskcopy Edit Fdisk Format Ren Rd Type
38
38 Minimize keystrokes Automate frequent/consistent procedures Do not need to interact with computer while batch files are running Automate frequent/consistent procedures Batch files can be run at anytime No user/computer interaction required Why batch files?
39
39 A batch file is a normal text file that contains DOS commands, each one on a separate line. String together series of commands executed sequentially with one command without human interaction or interruption Must be an ASCII file Created with Edit, COPY CON, text editor, or word processor which has “Save as text file” option Has.BAT extension Each line in batch file contains only one command Batch file
40
40 A batch file is a program. Each line in a batch file must contain only one command. To run a batch file at the DOS prompt you type the batch file name, with or without the “.bat” extension. To write a batch file you must use a program that creates ASCII text files. If a file is readable with the TYPE command, it is an ASCII text file. Sometimes easier to use COPY CON instead of EDIT to write simple batch file. Syntax: COPY CON filename Drawbacks to using COPY CON: Cannot correct errors once is pressed Cannot correct errors in existing files Writing a batch file
41
41 Batch file commands
42
42 Batch file commands (cont.)
43
43 REM command (remarks) allows user to place comments in file that are displayed but not executed. REM allows file to be documented: Gives explanation of the purpose of a program Can include name of batch file, last time it was updated, and author of batch file REM
44
44 ECHO ON command: Displays command and the command’s output to the screen Is the default value ECHO OFF command: Minimizes screen clutter User turns off display of command then only see command’s output @ECHO OFF will not display the words “ECHO OFF” when the batch file is run. ECHO OFF ECHO school Echo
45
45 PAUSE: Used to suspend processing of a batch file. A message “Press any key to continue...” is displayed instructing the user to continue. LABEL: Used to identify a section in a batch file by placing a : at the beginning of the the line followed by a word. :NICE :NICE GOTO: Used to move to another location of the batch file. Instead of going to the next line of the script, a label is used to identify the location to move to. GOTO NICE or GOTO :NICE GOTO NICE or GOTO :NICE Pause, label, goto
46
46 @ECHO OFF :begin ECHO Hello World GOTO :begin To STOP a batch file: press Ctrl+C Or press Ctrl+Break Example (goto)
47
47 at.batC:\> school C:\>phone.bat Start of “phone.bat” school End of “phone.bat” CALL: Used to jump to and run a different batch program from within another, and then return to the main batch program. It does not cause the original program to stop. @ECHO OFF ECHO Start of “phone.bat” CALL at.bat ECHO End of “phone.bat” call
48
48 Replaceable Variables: are used in batch files to take user input. We can use any of the replaceable parameters %1, %2, %3, %4, %5, %6, %7, %8 and %9 as temporary holding spaces. Replaceable Variables MAKE.bat test hello test3C:\> Batch File%2 %1%3
49
49 IF: Provides conditional processing in a batch file. If the specified condition is true, the command that follows is executed. If a specified condition is not true the command that follows is ignored, and the second command is executed. IF %1 == hello GOTO :right GOTO :wrong IF VARIABLE == TEXT
50
50 @ECHO OFF IF EXIST hello.txt GOTO :yes GOTO :no :yes TYPE hello.txt GOTO :end :no EDIT hello.txt GOTO :end :END IF EXIST
51
51 CHOICE: Used to request user input during the execution of a batch file. Usually displays a prompt that has characters for the user to choose to make their selection. Usually used with ERRORLEVELS. CHOICE Batch Command
52
52 @ECHO OFF ECHO Pick “A” for Ants ECHO Pick “B” for Bats ECHO Pick “C” for Cows CHOICE /C:ABC If the user picks “A” errorlevel 1 is generated. If the user picks “B” errorlevel 2 is generated. If the user picks “C” errorlevel 3 is generated. IF errorlevel ==3 goto Cows IF errorlevel ==2 goto Bats IF errorlevel ==1 goto Ants :ANTS ECHO You picked “A” ECHO You like ants. GOTO END CHOICE Batch Command (cont.)
53
53 Any Question?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.