DOS can also enable us to do automated sequencing of different DOS commands by using “batch files” which are named this since you batch together a sequence of DOS commands and store them in a file with an extension of “.bat”. This saves time by doing a bunch of commands all at once as opposed to one by one. To make a batch file, you can use the programs notepad, MS Word (save it as plain text) or the DOS “copy” command and save it with a “.bat” file extension. When DOS initially comes onto your screen, type in the batch file’s name without the extension “.bat”.
I hope you have a more in depth understanding of DOS and all of its concepts, rules and its usefulness. Though Windows is the dominant system of today, DOS can have its advantages over Windows in its quickness and exactness.
Friday, October 5, 2007
the copy,diskcopy,rename,move,erase and scandisk commands
The COPY command (it’s an internal command, remember a basic command contained in command.com) copies one or more files from one disk to another. It also lets you make another copy of a given file on the same disk but with a different file name. The order in which you type a copy command is COPY [d:] filespec [d:] [filename [.ext]]. Remember anything in brackets signifies that it’s an optional part of the command. Filespec signifies the specification of the file or group of files to be copied. Both the source (where your file is located waiting to be copied) and target (the place where you will copy your file) directories must be specifically made known. And once again, the notion of the default drive/directory kicks into gear if you don’t specify either or both the source and target directories.
The DISKCOPY command (an external command not contained in command.com) allows you to copy one diskette onto another. It doesn’t just copy one file at a time; it copies the whole disk exact to the target disk. This means that all the information on the target disk will be erased and replaced with the source disk information. DISKCOPY also copies system and hidden files, even if they are fragmented. The way in which you enter the information in the DOS window for this is DISKCOPY [d:] [d:] for example “diskcopy c: b:”.
The erase command (an internal command) deletes a file or group of files from a disk. You type it in the DOS window as follows: “Erase filespec” or “del[ete] filespec”. The Rename command is another internal command that changes the name of a file or group of files. To type it in the DOS window, it goes like this: “REN[ame] filespec filename [.ext]. The MOVE command is another internal command that changes the name of a directory. The form to type it in the DOS window is “move . SCANDISK (an external command) is in the later versions of DOS and is like CHKDSK and checks the status of a disk and prepares the status report.
The DISKCOPY command (an external command not contained in command.com) allows you to copy one diskette onto another. It doesn’t just copy one file at a time; it copies the whole disk exact to the target disk. This means that all the information on the target disk will be erased and replaced with the source disk information. DISKCOPY also copies system and hidden files, even if they are fragmented. The way in which you enter the information in the DOS window for this is DISKCOPY [d:] [d:] for example “diskcopy c: b:”.
The erase command (an internal command) deletes a file or group of files from a disk. You type it in the DOS window as follows: “Erase filespec” or “del[ete] filespec”. The Rename command is another internal command that changes the name of a file or group of files. To type it in the DOS window, it goes like this: “REN[ame] filespec filename [.ext]. The MOVE command is another internal command that changes the name of a directory. The form to type it in the DOS window is “move
MD,RD and CD commands
In DOS you can create additional directories on a disk. These directories are known as “Subdirectories”. The directory that contains them is known as the “parent” directory. The directory that is created at the time the disk is formatted is called the “root” directory and is denoted by the backslash “\”. There are 3 commands for dealing with directories (folders) in DOS: the MD, RD and CD commands. MD (or MKDIR) allows you to create a new subdirectory and you type this preceding the file name you will name it for example if you want to make a subdirectory called “abc” you will type in md abc. To make a folder inside another folder you need to type first the location of where the main folder you want to store this subfolder so for example if you want to save “main” folder inside folder abc it would read as follows : md [d:]\ abc\main. Once again the [d:] stands for the certain drive that the folder abc was stored in. TO make a directory in another drive although you are in a different drive you type in md [d:] and specify that other drive toy want your new folder to be in. RD (or RMDIR) allows you to remove a directory but you can only remove a directory if it’s empty. When removing for example “abc” you type in rd abc. You always need a verb (remove) and an object to remove (ex: abc) to use this command.
The CD (or CHDIR) command signals changing from one directory location to another as you jump from one branch of the tree to another. To move from any directory to the root of the current drive you type in cd\. The backslash “\” refers to the root. For example if you type in cd\word the first “\” refers to the root and this command is telling you to find this word folder in the root directory. There’s another notion in DOS of dot “.” and dot dot“..”. In order to move from any directory to its immediate parent directory you type in “cd..” since 2 dots refer to the parent which is listed above the directory you are in. If you type in one dot after cd like this “cd.” Just leaves you in the current directory that you are in. If you type in “cd” by itself it will cause DOS to output a “fully qualified path” for the current directory. A fully qualified path is a listing of all the directories starting with the drive letter followed by “\” for example “C:\” on the path down the branches up to and including the current one. In the same folder you can only have one file with the same name, but outside that folder you can have the same name in another folder. If you want to see the fully qualified path of C:\> DIR docs\abc.doc DOS is looking for the “docs” folder in wherever directory you are in and it’s also looking for the abc.doc file name inside this docs folder once it’s found.
The CD (or CHDIR) command signals changing from one directory location to another as you jump from one branch of the tree to another. To move from any directory to the root of the current drive you type in cd\. The backslash “\” refers to the root. For example if you type in cd\word the first “\” refers to the root and this command is telling you to find this word folder in the root directory. There’s another notion in DOS of dot “.” and dot dot“..”. In order to move from any directory to its immediate parent directory you type in “cd..” since 2 dots refer to the parent which is listed above the directory you are in. If you type in one dot after cd like this “cd.” Just leaves you in the current directory that you are in. If you type in “cd” by itself it will cause DOS to output a “fully qualified path” for the current directory. A fully qualified path is a listing of all the directories starting with the drive letter followed by “\” for example “C:\” on the path down the branches up to and including the current one. In the same folder you can only have one file with the same name, but outside that folder you can have the same name in another folder. If you want to see the fully qualified path of C:\> DIR docs\abc.doc DOS is looking for the “docs” folder in wherever directory you are in and it’s also looking for the abc.doc file name inside this docs folder once it’s found.
appropriate DOS file name structure, wild card characters
All file names in DOS must have the following structure [description of which drive and/or directory to find the file] filename [.extension]. Things in [ ] are optional. A filename doesn’t need an extension but if you do put the extension it has to be a maximum of 3 characters long and must be preceded by a period “.”. File names must be unique. The filename in DOS is made up of a string of up to 8 acceptable characters. Acceptable characters for DOS file names are as followed: A-Z, 0-9, $, &, #, @, ! , ‘, (), -, {}, _, ^, ~, and `.Wild card characters (also known as global file-name characters) function just as they would in a card game in DOS. A wild card can take on any identity of another card like for example is an Ace is wild, then it can be a King, 6 etc…There are 2 wild card characters * and ?. The * character functions in this way. It can represent any 0 or more characters of a file name. The ? character can represent any 0 or one character of a file name. So for example if you type in dir *.doc, the directory finds all files with the .bat extension but if you type dir ?.doc the directory finds all files with a filename of one character(remember you need a filename with a minimum of one character but the ? wild card character can represent 0 OR 1 character).
commands dir /p, dir /w
The table of contents in DOS is called a directory and is abbreviated “DIR” and this command’s function is to list the directory of a disk. Remember that it is an internal command so it’s a needed and basic command preformed by command.com. The DIR command let’s you look for a specific file. If you type in DIR only, you get the default drive aka the last drive that you were on. In a DOS window when you see DIR in pointer arrows that are created by pressing shift and "," and shift and "."
followed by a file name such as abc this means “abc” is a folder. If after DIR you type “/p” it’s function is to pause the information on the screen by showing you a full screen full by screen full and if you press any key it will move to the next screen full of information displayed. If you type /w after DIR then you will receive a condensed version of information in 3 columns giving you only the file names without the date or time.
In /w mode, anything in brackets [ ] signals it’s a folder so [abc] is a folder.
Default drive, Internal commands and External commands
Some concepts one must keep in mind when working with DOS are the notion of the default drive, internal commands and external commands. The default drive is the drive that is being focused on by the computer and the DOS expects to find the programs and files that you refer to in this drive. A drive is represented by a letter followed by a colon ex: “C:”. In DOS the drive waiting for a command would read as “C:\>-”. The “\” backslash refers to the root directory and the “>” is just a symbol to show what drive you are using. The blinking “_” is the cursor waiting for you to type information in the screen, Any command issued without specifically referring to a drive goes to the default drive i.e. the last drive that was referred to on the computer. One can change the current drive from for example C: to D: since while sitting on drive C: type in “D:” and the computer now responds with the “D:\>” drive as the current drive. In order to go back in history press the up arrow key. In order to go forward in the history of actions press the down arrow key.
A good analogy to remember how internal and external commands work is the analogies of different doctors. When you need to go to a doctor for a cold, you go and see a generalized practitioner. When you need to see the doctor for a brain aneurysm, you see a specialist doctor for the brain. Well internal commands are like the generalized practitioner in the sense that the commands are contained in command.com and are part of the DOS program itself and are basic file commands that are inputted in by you in the DOS window after a drive such as “DIR” which lists the files in the directory, “TYPE” which displays file contents on the monitor, “DATE” which changes the system date, “RENAME” which renames disk files, “COPY” which copies one or more files, “ERASE” which erases one or more files and “TIME” which changes the time for the system. A general practitioner has to know a little bit of everything medically speaking, just like the internal commands need to be there since they are the basic files required. External commands function like the specialist doctor and are commands that are not contained in the program command.com. Each time that DOS needs to execute them, it must first load them from a disk for example by typing in “CHKDSK” you check the status of a disk and prepare the status report, “DISKCOPY” copies a complete diskette and “FORMAT” prepares the disk for use and internalizes the disk so that DOS can store information on it. Formatting a disk writes tracks and sectors on the disk and puts important files on it like the operating system files. Just remember that formatting will erase all of the information on a disk if there was any information there and to be usable a disk needs to be formatted. Format command also examines that particular disk for any defective sectors and stores the information in FAT(file allocation table), initializes the directory, sets up space for FAT and records the boot program in the boot record.
In DOS when you type in a command it must be spelled correctly but it doesn’t matter if it’s capitalized or not. Also if something is in brackets [ ] that means it’s an optional part of the command. When you are doing any command, you always need a drive where this command will take place and if you don’t specify the drive, the default drive is assumed. Every time you see “/” as part of a command, that is called a switch and it turns the mechanism on for that part of the command that you have typed after it for example if you type FORMAT [d:] [/s] [/v] you are saying to format the drive (whenever you see [d:] it means the description of the drive/directory you are working with in my examples to find a file) and are causing the operating system files to be transferred to the new disk (s stands for system and once added to the disk it can store information on it and it’s bootable so this allows the disk to be a recovery/rescue disk) and allows you to specify a volume label to identify the disk( the /v command part did this).
In DOS when you type in a command it must be spelled correctly but it doesn’t matter if it’s capitalized or not. Also if something is in brackets [ ] that means it’s an optional part of the command. When you are doing any command, you always need a drive where this command will take place and if you don’t specify the drive, the default drive is assumed. Every time you see “/” as part of a command, that is called a switch and it turns the mechanism on for that part of the command that you have typed after it for example if you type FORMAT [d:] [/s] [/v] you are saying to format the drive (whenever you see [d:] it means the description of the drive/directory you are working with in my examples to find a file) and are causing the operating system files to be transferred to the new disk (s stands for system and once added to the disk it can store information on it and it’s bootable so this allows the disk to be a recovery/rescue disk) and allows you to specify a volume label to identify the disk( the /v command part did this).
the DOS shell concept
Conceptually speaking, just like the shell of a walnut the DOS programs command.com and cmd.com surround the operating system’s insides and provide the end user with something firm and easy to grasp. The shell is the interface that the user communicates with.Command.com and Cmd.exe are DOS programs located in the shell. The kernel is the machine language programs which is surrounded by the shell. The hardware (which would be useless without software) is the computer machine itself and is surrounded by the kernel. The languages and tools encapsulate the shell and is the outermost layer of the DOS analogy to a walnut.
In DOS, folders and subfolders are labeled directories and subdirectories. In DOS one can create these directories and subdirectories. If you type “Format” on the DOS screen and hit “Enter” it prepares a disk for use. If you type “Copy” and hit “Enter” it makes a copy of the file. If you type “CHKDSK” and hit “Enter” it checks the characteristics of the disk and system. DOS provides the software substructure and facilitates for the other programs that run on the computer and allows you to run programs, keep track of files on disk and handle input and output.
In DOS, folders and subfolders are labeled directories and subdirectories. In DOS one can create these directories and subdirectories. If you type “Format” on the DOS screen and hit “Enter” it prepares a disk for use. If you type “Copy” and hit “Enter” it makes a copy of the file. If you type “CHKDSK” and hit “Enter” it checks the characteristics of the disk and system. DOS provides the software substructure and facilitates for the other programs that run on the computer and allows you to run programs, keep track of files on disk and handle input and output.
Subscribe to:
Posts (Atom)