COMPUTER TRAINING: Descriptive DOS Command

Monday, 24 December 2012

Descriptive DOS Command

Descriptive DOS Command
 
attrib
 
Change or view the attributes of one or more files. It defaults to displaying the attributes of all files in the current directory.
 
Options:
• To add an attribute attach a '+' in front of it.
• To remove an attribute attach a '-' in front of it
• Attributes include
o A - Archived (used mainly by file archiving software)
o H - Hidden
o S - System
o R - Read-only
 
SYNTAX:
attrib [+|-ahrs] [filespec]
 
 
 
Descriptive DOS Command
 
cd or chdir
 
Change current directory.
 
SYNTAX:
cd directory
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
chkdsk
 
Verifies a hard disk or a floppy disk for file system integrity.
 
Options:
• /F : Fixes errors on the disk
• /V : Displays the full path and name of every file on the disk
 
SYNTAX:
chkdsk drive [[path]filename] [/F] [/V]
 
 
 
 
 
Descriptive DOS Command
 
cls
 
This command Clears the screen.
 
SYNTAX:
cls
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 

copy

 
Copies files from one location to another. The destination defaults to the current directory. If multiple source files are indicated, the destination must be a directory, or an error will result.
 
SYNTAX:
copy filespec [destination]
 
Files may be copied to devices (e.g. "copy file lpt1" would send the file to the printer on lpt1. "copy file con" would output to screen, which would be the same as type.
 
Most useful to note that "copy file.txt+file2.txt > file_cat.txt" will concatenate the files and output them as file_cat.txt.
 
 
 
Descriptive DOS Command
 
copy device
 
SYNTAX:
copy device filename
 
In this usage, data is written from the given device to the file until the end-of-file character (ASCII character 26, which may be typed as ctrl-Z) is encountered. The most commonly used device is named con, which is short for "console"; thus, copy con filename would allow the user to type directly into a file, and press ctrl-Z when finished.
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
defrag
 
Defragments disk drive
 
SYNTAX:
defrag driveletter
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
del or erase
 
Deletes files.
 
SYNTAX:
del filename
erase filename
To delete files in Quiet mode
del /Q filename
 
 
 
 
 
 
 
Descriptive DOS Command
 
deltree
 
Deletes a directory along with all of the files and subdirectories that it contains. Normally, it will ask for confirmation of such a drastic action.
 
SYNTAX:
deltree [/y] directory
 
The /y parameter if present tells the deltree command to carry out without first prompting for confirmation.
 
The deltree command is not included in recent Microsoft Windows operating systems. Deleting a non-empty directory in those versions of Windows where the command is not included, can be achieved by the use of the rmdir command as in the following example:
rmdir /s directory
 
 
 
Descriptive DOS Command
 
dir
 
Displays contents of a directory.
 
Options :
• /w : Wide list format
• /p : Pause at every page
• /s : Also look in subdirectories
• /a[xx] : Display files with the specified attributes only
• /o[xx] : Modifies sort order
 
SYNTAX:
dir [options] [filespec]
 
 
 
 
 
Descriptive DOS Command
 
echo
 
Prints its own arguments back out to the DOS equivalent of the standard output stream. Usually, this means directly to the screen, but the output of echo can be redirected like any other command. Often used in batch files to print text out to the user.
 
SYNTAX:
echo this is textOutputs 'this is text'
echo.Outputs a blank line
 
Another important use of the echo command is to toggle echoing of commands on and off in batch files.
 
echo onturns on echoing of commands
echo offturns off echoing of commands
 
 
Traditionally batch files begin with the @echo off statement. This says to the interpreter that echoing of commands should be off during the whole execution of the batch file thus resulting in a "tidier" output. The @ symbol declares that this particular command (echo off) should also be executed without echo.
 
For example the following 2 batch files are equivalent:
Batch1.bat:
@echo off
echo The files in your root directory:
dir /b /a-d c:\
 
Batch2.bat:
@echo The files in your root directory:
@dir /b /a-d c:\
 
Echo can be used to write to files directly from the console, by redirecting the output stream:
echo text > filename
 
Echo can also be used to append to files directly from the console, again by redirecting the output stream:
echo text >> filename
 
To type more than one line from the console into a file, use copy con (above).
 
 
 
 
Descriptive DOS Command
 
Edit
 
EDIT filename
 
Brings up the DOS Edit program so you can make changes in a text file. This is a very simple text editor and won't work with regular word processing documents.
 
 
 
 
 
Descriptive DOS Command
 
exit
 
Exits the current batch script or the controlling thread. When running from Windows this will close the command prompt.
 
SYNTAX:
EXIT [/B] [exitcode]
/B        Exit the current batch script and set ERRORLEVEL to exitcode
 
Without this option, the controlling thread and any intermediate batch files are immediately exited, and the process return code is set to exitcode.
 
 
 
 
 
 
Descriptive DOS Command
 
fdisk
 
Manipulates hard disk partition tables. The name derives from IBM's habit of calling hard drives fixed disks. When run from the command line, it displays a menu of various partitioning operations:
1. Create DOS partition or Logical DOS Drive
2. Set active partition
3. Delete partition or Logical DOS Drive
4. Display partition information
5. Change current fixed disk drive
 
 
 
 
 
 
 
Descriptive DOS Command
 
find
 
A filters to find lines in the input data stream that contain or don't contain a specified string and send these to the output data stream.
Find may also be used as a pipe.
 
SYNTAX:
find "keyword" < ''inputfilename'' > ''outputfilename''
 
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]
 
/VDisplays all lines NOT containing the specified string.
/CDisplays only the count of lines containing the string.
/NDisplays line numbers with the displayed lines.
/IIgnores the case of characters when searching for the string.
"string"Specifies the text string to find.
[drive:][path]filenameSpecifies a file or files to search.
 
If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command.
 
 
 
 
Descriptive DOS Command
 
format
 
Delete all the files on the disk and reformat it for MS-DOS In most cases, this should only be used on floppy drives or other removable media. This command can potentially erase everything on a computer's hard disk.
 
/autotest and /backup is an undocumented feature.
Adding it formats the drive without a confirmation prompt.
 
SYNTAX:
format [options] drive
FORMAT drive: [/V[:label]] [/Q] [/F:size] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/T:tracks /N:sectors] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/1] [/4] [/B | /S] [/C]
FORMAT drive: [/Q] [/1] [/4] [/8] [/B | /S] [/C]
 
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]
 
/V[:label]Specifies the volume label.
/QPerforms a quick format.
/F:sizeSpecifies the size of the floppy disk to format (such as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).
/BAllocates space on the formatted disk for system files.
/SCopies system files to the formatted disk.
/T:tracksSpecifies the number of tracks per disk side.
/N:sectorsSpecifies the number of sectors per track.
/1Formats a single side of a floppy disk.
/4Formats a 5.25-inch 360K floppy disk in a high-density drive.
/8Formats eight sectors per track.
/CTests clusters that are currently marked "bad."
 
 
 
 
 
Descriptive DOS Command
 
help
 
It gives help about DOS.
help 'command' would give help on a specific command, in MS-DOS 6 a HELP program was started which would give more details and examples, earlier versions basically gave the same information as command/? would give.
 
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
InterLnk
 
MS-DOS 6 and above command to network PCs using a null modem cable or LapLink cable.InterLnk is the client-side program (InterSvr is the server) which mapped the drives of the machine running InterSvr to the local machine.
 
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
InterSvr
 
MS-DOS 6 and above command used to network PCs using a null modem cable or LapLink cable. The server-side version of InterLnk, it also immobilizes the machine it's running on as it's an active app (As opposed to a TSR) which must be running for any transfer to take place.
 
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
label
 
Changes the label on a logical drive, such as a hard disk partition or a floppy disk.
 
 
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
md or mkdir
 
Makes a new directory. The parent of the directory specified must already exist.
 
SYNTAX:
md directory
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
mem
 
Displays memory usage.
 
SYNTAX:
mem
 
 
 
 
Descriptive DOS Command
 
memmaker
 
Starting from version 6, MS-DOS included the external program MemMaker which was used to free system memory (especially Conventional memory) by automatically reconfiguring Autoexec.bat and Config.sys files. This was usually done by moving TSR Programs to the Upper memory. The whole process required 3 system restarts. Before the first restart the user was asked whether he wanted to enable EMS Memory or not. The use of MemMaker was popular among gamers who wanted to enable or disable Expanded memory in order to run a game which required EMS or not. The result would however not be as good as someone chaning the settings themself.
 
Options :
• /BATCH Runs MemMaker in batch (unattended) mode. In batch mode, MemMaker takes the default action at all prompts.
• /UNDO Instructs MemMaker to undo its most recent changes.
 
 
 
 
Descriptive DOS Command
 
more
 
Pages through the output so that you can view more than one screen of text.
 
SYNTAX:
command | more
 
More may also be used as a filter.
more < inputfilename
 
 
 
 
 
Descriptive DOS Command
 
move
 
Moves or renames a file.
 
SYNTAX:
move filename newfilename
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
msd
 
Provides detailed technical information about the computer's hardware and software.
 
SYNTAX:
msd
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
pcpark
 
Parks the hard disk(s) (stops their turning) in order to enable safe shutdown; only used on early versions.
 
SYNTAX:
pcpark
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
rd or rmdir
 
Remove a directory, which must be empty of files.
 
SYNTAX:
rd directory
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
rem
 
Remark statement, normally used within a batch file. However on the command line, rem can also be used to create a zero length file by redirecting an empty remark statement to a filename.
 
SYNTAX:
rem > newfilename
 
 
An alternative way to not run a specific statement in a batch file is creating a label that will never be used, ::.
 
 
 
 
 
Descriptive DOS Command
 
ren
 
Renames a file. Unlike the move command, this command cannot be used to rename subdirectories, or rename files across drives.
 
SYNTAX:
ren filename newname
 
 
A more useful function of this command is to mass rename files by the use of wildcards. For example, the following command will change the extension of all files in the current directory from htm to html:
ren *.php *.php
 
 
 
 
Descriptive DOS Command
 
scandisk
 
Disk diagnostic utility
 
SYNTAX:
scandisk driveletter
 
 
Scandisk is a replacement for the chkdsk utility. Its primary advantages over chkdsk is that it is more reliable and has the ability to run a surface scan which checks and marks bad sectors on the disk.
 
 
 
 
 
 
Descriptive DOS Command
 
set
 
Sets environmental variables.
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
sort
 
A filter to sort lines in the input data stream and send them to the output data stream.
 
SYNTAX:
sort < inputfilename > outputfilename
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
time and date
 
Set/display the date and time
 
SYNTAX:
date
time
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
tree
 
Shows the directory tree of the current directory Options:
 
/F (Displays the names of the files in each folder.)
/A (Use ASCII instead of the extended characters.)
 
SYNTAX:
tree [options] [directory]
 
 
 
 
 
 
 
Descriptive DOS Command
 
truename
 
SYNTAX:
truename filename
 
Outputs the entire path (full directory and filename) of a file. For example, if the working drive and directory were C:\PROGRAMS and one typed truename fish, the output would beC:\PROGRAMS\FISH. This command was rarely, if ever, documented in DOS manuals.
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
type
 
Display a file. The more command is frequently used in conjunction with this command, e.g. type long-text-file | more.
 
SYNTAX:
type filename
 
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
undelete
 
Restores file previously deleted with del. By default all recoverable files in the working directory are restored. The options are used to change this behaviour. If the MS-DOS mirror TSR program is used, then deletion tracking files are created and can be used by undelete.
 
Options :
• /list : lists the files that can be undeleted.
• /all : Recovers all deleted files without prompting. Uses a number sign for missing first character.
• /dos : Recover only MS-DOS aware files, ignore deletion tracking file.
• /dt : Recover only deletion tracking file aware files.
 
SYNTAX:
undelete [filespec] [/list|/all][/dos|/dt]
 
 
 
 
Descriptive DOS Command
 
ver
 
Shows the version of MS-DOS you are using.
Some versions of MS-DOS support an undocumented /r switch, which will show the revision as well as the version.
 
SYNTAX:
ver [/r]
 
 
 
 
 
 
 
 
Descriptive DOS Command
 
xcopy
 
Copy entire directory trees.
 
SYNTAX:
xcopy directory [destination-directory]
 
Copies files and directory trees.
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N]
 
sourceSpecifies the file(s) to copy.
destinationSpecifies the location and/or name of new files.
/ACopies files with the archive attribute set, doesn't change the attribute.
/MCopies files with the archive attribute set, turns off the archive attribute.
/D:date Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/PPrompts you before creating each destination file.
/SCopies directories and subdirectories except empty ones.
/ECopies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/WPrompts you to press a key before copying.
/CContinues copying even if errors occur.
/CContinues copying even if errors occur.
/IIf destination does not exist and copying more than one file, assumes that destination must be a directory.
/FDisplays full source and destination file names while copying.
/FDisplays full source and destination file names while copying.
/LDisplays files that would be copied.
/HCopies hidden and system files also.
/ROverwrites read-only files.
/TCreates directory structure, but does not copy files. Does not include empty directories or subdirectories.
/T /Eincludes empty directories and subdirectories.
/UUpdates the files that already exist in destination.
/KCopies attributes. Normal Xcopy will reset read-only attributes.
/YOverwrites existing files without prompting.
/-YPrompts you before overwriting existing files.
/NCopy using the generated short names.
 
 
 
 

No comments:

Post a Comment