Professional Documents
Culture Documents
To add an attribute attach a '+' in front of it. filespec: name and if necessary path of the new
To remove an attribute attach a '-' in front of it batch file
Attributes include parameters: switches
o R - Read-only
o A - Archive cd or chdir
o S - System
o H - Hidden Change current working directory. Displays the
o /D - Process folders as well. current working directory when used without a
path parameter.
cd /R : Searches for defective sectors and recovers
legible information (applies /F)
displays the current working directory on the current /X : Unmounts the volume before processing if
drive. needed. (Note: Unmounting temporarily
invalidates all pointers/handlers to the volume
until process is completed)
cd \ cls
changes the working directory to the root (top level) Clears the screen.
directory of the current drive. cls
Equivalent to the Unix clear.
Equivalent to the Unix command cd (with a path
parameter), or pwd (without a parameter). cd .. copy
changes to the parent directory.
Copies files from one location to another. The
chcp destination defaults to the current directory. If
multiple source files are indicated, the
Changes the code page used to display destination must be a directory, or an error will
character glyphs in a console window. result.
chcp [codepage] Syntax:
copy from [source\filename] to [destination\folder]
With a numeric parameter, this command changes the Files may be copied to devices. For example,
codepage setting to codepage. Without a parameter, copy file lpt1 sends the file to the printer on
the command displays the currently active codepage. LPT1. copy file con outputs file to the screen
("console"), which can also be done using type
chkdsk file. Devices themselves may be copied: copy
con file takes the text typed into the console
Verifies a storage volume (hard disk, partition, and puts it into file, stopping when EOF (Ctrl+Z)
floppy disk, flash drive, etc) for file system is typed.
integrity. Files may be concatenated using +. For
example, copy file1+file2 file_cat will
concatenate the files and output them as
Options:
file_cat. There are two switches to modify the
command's behaviour, /a (text mode, the
/F : Fixes errors on the volume (without /F ,
default) and /b (binary mode). In text mode,
chkdsk only detects errors)
copy will stop when it reaches the EOF
/P : Forces a full verification
character; in binary mode, the files will be
concatenated in their entirety, ignoring EOF Syntax:
characters.
Examples of usage: del filename
copy /a alpha.txt + beta.txt gamma.txt erase filename
copy /b alpha.mpg + beta.mpg gamma.mpg
Equivalent Unix commands are cp (for copying)
and cat (for concatenation). Device files may be Options
copied in Unix as well, e.g. cp file /dev/tty will
display a file on the screen (but cat file is more *.* All files in current folder
commonly used here). *.* /s all files in current folder and sub folders,
Equivalent RT-11/RSX-11/OpenVMS command Equivalent to the Unix command rm.
is copy. Equivalent in RT-11/RSX-11/OpenVMS
Examples of usage: operating systems line is delete command
copy con filename.extension which can be contracted to del.
The default parameters of dir can be set using the Full-screen text editor, included with MS-DOS 5
DIRCMD environment variable. and 6, OS/2 and Windows NT to 4.0
Equivalent to the Unix command ls (the option -l is Windows 95 and later, and W2k and later use
"long" list format, it works the opposite way from /w.) Edit v 2.0
PC-DOS 6 and later use the DOS E Editor.
Equivalent in RT-11/RSX-11/OpenVMS operating DR-DOS used editor up to version 7.
systems line is directory command which can be
contracted to dir. edlin
fc or comp find
Compares two files or sets of files and displays A filter to find lines in the input data stream
the differences between them. that contain or don't contain a specified string
FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:] and send these to the output data stream.
[path1]filename1 [drive2:][path2]filename2 Find may also be used as a pipe.
FC /B [drive1:][path1]filename1 [drive2:] find "keyword" < ''inputfilename'' > ''outputfilename''
[path2]filename2
/A Displays only first and last lines for each set of Searches for a text string in a file or files.
differences.
/B Performs a binary comparison. FIND [/V] [/C] [/N] [/I] "string" [[drive:]
/C Disregards the case of letters. [path]filename[ ...]]
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches /V Displays all lines NOT containing the specified
to the specified number of lines. string.
/N Displays the line numbers on an ASCII /C Displays only the count of lines containing the
comparison. string.
/N Displays line numbers with the displayed lines. which can not create filesystem. After
/I Ignores the case of characters when searching formatting one should use initialize (contracted
for the string. to init) command to create filesystem
"string" Specifies the text string to find. (Equivalent to MS-DOS command format /q or
[drive:][path]filename Specifies a file or files to search. "quick format").
pause ren
Suspends processing of a batch program and Renames a file. Unlike the move command, this
displays the message 'Press any key to continue. command cannot be used to rename
. .'. subdirectories, or rename files across drives.
ren filename newname
pcpark You can rename files in another directory by
using the PATH parameter:
Parks the hard disk heads in order to enable ren [path]|[filename] [newfilename]
safe shutdown; only used on early versions. An example could be:
pcpark ren c:\Windows filex.txt filey.txt
No Unix equivalent. On DOS with long filename support, care must
MS-DOS 3.2 (and possibly others) used the be taken when directories have spaces in their
command HHSET names like "Documents and Settings". In these
cases double-quotes are used to enclose them:
print ren c:\"Documents and Settings"\"All Users"\Desktop
filex.txt filey.txt
Mass renames can be accomplished by the use
of wildcards. For example, the following /F:space Allocates file space (in bytes) for file-sharing
command will change the extension of all files information.
in the current directory which currently have /L:locks Sets the number of files that can be locked at
the extension htm to html: one time.
ren *.htm *.html
In Unix, this functionality of a simple move is smartdrive
provided by the mv command, while batch
renames can be done using the rename Main article: SmartDrive
command.
sort
scandisk
A filter to sort lines in the input data stream and
Disk diagnostic utility. Scandisk was a send them to the output data stream.
replacement for the chkdsk utility, starting with sort < inputfilename > outputfilename
later versions of MS-DOS. Its primary Similar to the Unix command sort. Handles files
advantages over chkdsk is that it is more up to 64k. This sort is always case insensitive. [7]
reliable and has the ability to run a surface scan
which finds and marks bad clusters on the disk. subst
It also provided mouse point-and-click TUI,
allowing for interactive session to complement A utility to map a subdirectory to a drive letter.
command-line batch run. [3]
set sys
Sets environmental variables. See Environment A utility to make a volume bootable. Sys
variable. rewrites the Volume Boot Code (the first sector
Since Windows 2000, it can even be used for of the partition that Sys is acting on) so that the
command line inputs by using Parameter /P code, when executed, will look for Io.sys. Sys
set /p choice=Type your text. also copies the core DOS system files, Io.sys,
echo You typed: "%choice%" Msdos.sys, and Command.com, to the volume.
Sys does NOT rewrite the Master Boot Record,
setver contrary to widely-held belief.
/F (Displays the names of the files in each The Microsoft Windows command processors do not
folder.) support this command.
/A (Use ASCII instead of the extended
characters.) type
/? (Shows the help)
Display a file. The more command is frequently
truename used in conjunction with this command, e.g.
type long-text-file | more.
truename type filename
or Equivalent to the Unix command cat.
truename drivename
or undelete
truename filename
or Restores file previously deleted with del. By
truename directory default all recoverable files in the working
If typed without a parameter then the current directory are restored. The options are used to
active drive pathname is displayed. change this behavior. if the MS-DOS mirror TSR
MS-DOS can find files and directories given their program is used, then deletion tracking files are
names, without full path information, if the created and can be used by undelete.
search object is on a path specified by the Syntax:
environment variable PATH. For example, if undelete [filespec] [/list|/all][/dos|/dt]
PATH includes C:\PROGRAMS, and file
MYPROG.EXE is on this directory, then if Options:
MYPROG is typed at the command prompt, the
command processor will execute /list : lists the files that can be undeleted.
C:\PROGRAMS\MYPROG.EXE /all : Recovers all deleted files without
the TRUENAME command will expand a name prompting. Uses a number sign for missing first
in an abbreviated form which the command character.
processor can recognise into its full form, and /dos : Recover only MS-DOS aware files, ignore
display the result. It can see through SUBST and deletion tracking file.
JOIN to find the actual directory. In the above /dt : Recover only deletion tracking file aware
example, files.
TRUENAME MYPROG
would display In Unix and Unix-like systems this differs from
C:\PROGRAMS\MYPROG.EXE filesystem to filesystem. People who use the
and for a substituted drive set up by ext2 filesystem can try the command e2undel.
subst d: c:\util\test
the command Ver
truename d:\test.exe
An internal DOS command, that reports the Copy entire directory trees.
DOS version presently running, and since MS-
DOS 5, whether DOS is loaded high. The Xcopy is a version of the copy command that can move
corresponding command to report the files and directories from one location to another.
Windows version is winver.
xcopy directory [destination-directory]
Options: DOS 5 and later Equivalent to the Unix command cp when used
with -r parameter.
/r : revision level, also shows whether DOS is
loaded high
/? : shows command line help.
Value returned:
verify
xcopy