Download as DOCX, PDF, TXT or read online from Scribd
Download as docx, pdf, or txt
You are on page 1of 5
19.
Explain the following commands-
1.cd - CD (or CHDIR) stands for create or change directory and it allows to display the name of or change the current directory or rather we can say come out of a directory. Syntax is CD [/D] [drive:][path] → Typing CD drive: displays the current directory in the specified drive. This CD (or CHDIR) command does not treat spaces as delimitersdue to which it allows to CD into a subdirectory name that contains a space without surrounding the name with quotes. For example: CHDIR program filesmozilla firefoxis the same CHDIR “program filesmozilla firefox” → If you type CD without any parameters it displays current drive and directory. CD.. specifies that you want to change to the higher directory in the current path. Whereas, using CD you can directly change to parent/root directory from any location in the current drive. →Using /D switch changes current drive in addition to current directory for a drive
2.dir- This command displays a list of files and subdirectories in a
directory. Syntax is: DIR [drive:] [path] [filename][/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4] Here, [drive:][path][filename] Specifies drive, directory, and/or files to list. /A:attributes Displays files with specified attributes. The possible attributes are as follow: D → Directories, R → Readonly files, H → Hidden files, A → Files ready for archiving, S → System files, – Prefix meaning not /B display in bare format with no heading information or summary /C Using this attribute with dir by default displays the thousand separator in file sizes. To disable display or separator use /- C /D Displays file list sorted by column. /L Uses lowercase in listing file names and subdirectories. /N Display in new long list format where filenames are onthe far right. /O:sortorder Displays list by files in sorted order. The sortorder attributes are as follow: N → By name (alphabetic), S → By size (smallest first), E → By extension (alphabetic), D → By date/time (oldest first), G → Group directories first, – Prefix to reverse order /P Display page wise pausing after each screenful of information and prompts to press any key to continue. /Q Displays the owner of a file or files. /S Displays files in specified directory and all subdirectories. Bear caution in using this in your root directory as you may end up in overflowing information. To stop the screen overflow at any point hit Pause-Break key. T:timefield This sorts and displays the list based on time fieldspecified. C for Creation, A for Last Access, W for Last Written /W Displays list width wise or wide list format. /X This is used to display the short names generated fornon8dot3 file names. Note that switches may be different in the DIRCMD environment variable, in which case just override present switches by prefixing any switch with – (hyphen), for example instead of using /P use /-P
3.copy - This command is useful in copying one or more files to another
file or location. Syntax is COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | B] [+source [/A | /B] [+…]] [ destination [/A | /B ]] The different switches that can be used with this command as follow alongwith their use. Source It specifies the file or files to be copied. /A Indicates an ASCII text file. /B This switch indicates a binary file. /D This allows the destination file to be created with decryption. destination This specifies the directory and/or filename for the new file or files. /V Helps to verify new files to be written correctly. /N Specifying this switch uses short filename, if available, whencopying a file with a non- 8dot3 file name. /Y If destination file already exists, this switch suppresses prompting to confirm you want to overwrite it and does it asap. /-Y Contrary to above switch, this causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. For appending multiple files for source use wildcard or file1+file2+file3 format and make sure to specify a single file for destination.
4. del - This command is useful in copying one or more files to another
file or location. Syntax is COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | B] [+source [/A | /B] [+…]] [ destination [/A | /B ]] The different switches that can be used with this command as follow alongwith their use. Source It specifies the file or files to be copied. /A Indicates an ASCII text file. /B This switch indicates a binary file. /D This allows the destination file to be created with decryption. destination This specifies the directory and/or filename for the new file or files. /V Helps to verify new files to be written correctly. /N Specifying this switch uses short filename, if available, whencopying a file with a non- 8dot3 file name. /Y If destination file already exists, this switch suppresses prompting to confirm you want to overwrite it and does it asap. /-Y Contrary to above switch, this causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. For appending multiple files for source use wildcard or file1+file2+file3 format and make sure to specify a single file for destination.
5.edit - This command is used to modify or change the data of a file.
Syntax is EDIT [/B] [/H] [/R] [/S] [filename(s)] Using switch /B you can force the edit in monochrome mode. /H displays the maximum number of lines possible for your system hardware. Whereas using /R and /S one can load files in read-only mode and force the use of short filenames respectively. [filename(s)] is used to specify file(s) to go edit. You can use wildcards (* and ?) to specify multiple files.
6. move – The mv command moves files and directories from one
directories to another , or renames a file or directory. If you move a file or directory to a new directory , it retains the base file name.
7.ren(rename) - This command is used to change/modify the name of a
file or files. Syntax is: REN [drive:] [path] filename1 filename2. Here, filename1 is source file for which you wanted to change the name, and filename2 will obviously become your new file name. Also note that you cannot specify a new drive or path for your destination file.
8.deltree - This command is used to remove a directory along with its
contents. Syntax is deltree [drive:path] here, [drive:path] specifies the directory name to be deleted. All the subdirectories and files in this directory will be deleted without prompt and there’s not getting back. So, keep caution while using this command
9.cls- It is used to clear the screen. Syntax is CL
10.Format - This command creates a new root directory and a File
Allocation Table (FAT) for the disk. In order for MS-DOS to be able to use a new disk you must usethis command to format the disk. FORMAT with /S switch When the disk is formatted with /s option, the disk can be used as a booting disk. C:>DOS>Format A: /s The above command copies the OS files MSDOS.SYS, IO.SYS and COMMAND.COM which are required for booting the machine from your system startup drive to the newly formatted disk. The disk can then be used for booting. FORMAT with /U switch Here’s the command C:DOS>Format A: /U This command specifies an Unconditional Format which destroys all existing dataand prevents you from later unformatting the disk. FORMAT with /Q switch This can be used only with the previously formatted disk. This deletes FAT, This is generally used for Quick formatting. Warning As Format command deletes all existing data, use this command with extreme caution. Any disk formatted (except with /U switch) may be later unformatted using the UNFORMAT command.