******************************************************************************** * This represents a summary of MS-DOS & PC-DOS versions 3.1 & 3.2. Not all of * * the commands will be present nor will the syntax necessarily be the same for * * each version of DOS. Feel free to modify this for whatever version you use. * * Please let me know of any corrections that are needed. JEB HAMILTON 5/20/87 * ******************************************************************************** Internal Commands ================= BREAK CHDIR (CD) CLS COPY CTTY DATE DIR ECHO ERASE (DEL) EXIT FOR GOTO IF MKDIR (MD) PATH PAUSE PROMPT REM RENAME (REN) RMDIR (RM) SET SHIFT TIME TYPE VER VERIFY VOL External Commands ================= APPEND ASSIGN ATTRIB BACKUP CHKDSK * CHMOD COMMAND COMP CONFIGUR DEBUG DISKCOMP * DISKCOPY * EDLIN EXE2BIN FC FDISK * FIND FORMAT * GRAFTABL GRAPHICS JOIN * KEYBxx LABEL * LINK MODE MORE PRINT * RECOVER * REPLACE RESTORE SELECT SHARE SIZE SORT SUBST * SYS * TREE XASSIGN XCOPY * - cannot be used on a network SYS Commands ============ CONFIG ANSI DRIVER VDISK Valid Characters for Filenames ============================== A-Z (a-z made uppercase) 0-9 ! # $ % & ' ( ) - @ ^ _ ` { } ~ : . file separator (drive:name.ext) b/ , ; = TAB delimiters/separators * multi character wildcard ? single character wildcard < redirect input > redirect output (>> appends file) / optional switch \ path or directory | piping for additional commands " + [ ] DEL not used Valid Device Names ================== PRN LPT1 LPT2 LPT3 AUX COM1 COM2 CON NUL don't use for filenames ok to use for extensions Editing Keys ============ F1 - copy one character F3 - copy remaining characters F2 c - copy up to "c" F4 c - skip up to "c" F5 - save input, give new line F6 - End Of File marker Ins - insert mode on/off Del - delete one character Backspace - left space & delete Ctrl H - left space & delete Tab - move 8 spaces right Ctrl I - move 8 spaces right Esc - cancel current line Ctrl [ - cancel current line Ctrl C - abort command Ctrl Scroll Lock - abort command Ctrl S - pause screen output Ctrl Num Lock - pause screen output Ctrl P - toggle output to printer Ctrl PrtSc - toggle output to printer Ctrl J - End Of Line marker Ctrl Z - End Of File marker EDLIN Commands ============== n edit line n # edit new line (at end of text) + or - n list +/- n lines from current line ("*") b,e L list text beginning at b, ending at e b,e P page text beginning at b, ending at e a I insert text at line a b,e D delete text beginning at b, ending at e b,e,a,c C copy text beginning at b, ending at e, at line a, c times b,e,a M move text beginning at b, ending at e, at line a b,e ? S string search for string in text beginning at b, ending at e b,e ? R s1 F6 s2 replace string1 with string2 (? asks each time) n W write n lines (from line 1) to disk n A append n lines from disk to the end of text a T file transfer file from disk and insert at line a E end edit & save file Q quit edit & do not save file Ctrl V X will give a Ctrl X (use for any Ctrl character) /B switch ignore Ctrl Z, edit entire file DEBUG Commands ============== E address list enter G =address go (execute) P =address value proceed C range address compare T =address value trace M range address move F range list fill N file name S range list search L addr sect sect load W addr sect sect write A address assemble U addr or range unassemble R register register D addr or range dump H value value hex math I value input Q quit O value byte output PROMPT Commands =============== PROMPT text $d ..... date $t ...... time $v ...... version $n ..... drive $p ...... directory $_ ...... CRLF $g ..... > $l ...... < $e ...... ESC $b ..... | $q ...... = $$ ...... $ $h ..... backspace $s ...... leading space c ...... character ANSI Escape Sequences ===================== PROMPT $e[#A (replace # & A with below, omitting any spaces shown) #;# H cursor position - row;column #;# f cursor position - row;column # A up # lines # B down # lines # C right # lines # D left # lines 0 J or J erase from cursor to end of display 1 J erase from beginning of display to cursor 2 J erase all of display 0 K or K erase from cursor to end of line 1 K erase from beginning of line to cursor 2 K erase all of line > 5 h make cursor invisible > 5 l make cursor visible s save cursor position u restore cursor position #;# R cursor position report (CPR) 6 n perform CPR when DSR received #;# r set screen size (1;25 default) c display screen size l s save character attributes l u restore character attributes #;#;# m graphics commands 0 - all attrib off 1 - bold on 3 - swap fgc & bgc 4 - underscore on 5 - blink on 7 - reverse on 8 - invisible on 81 - bold off 84 - underscore off 85 - blink off 87 - reverse off 88 - invisible off 30 to 37 - foreground colors 40 to 47 - background colors 48 to 55 - background colors (high intensity) =# h or =# l screen commands set reset 0 - 40x25 B&W 1 - 40x25 COL 2 - 80x25 B&W 3 - 80x25 COL 4 - 320x200 COL 5 - 320x200 B&W 6 - 640x200 B&W 64 - 640x400 80x25 72 - 640x400 80x50 7 - wrap at end of line #;#;# p reassign keys (ex - 65;90p has "A" key display "Z") 0;#;"string";13p assign words to keys (ex - 0;68;"DIR";13p has "F10" give DIR) 0 q disables key reassignments 1 q enables key reassignments CONFIG.SYS File =============== BUFFERS=# 2 default, 20 good FCBS=x,y 4,0 default, 4,0 good FILES=# 8 default, 20 good COUNTRY=xxx 001 for USA symbols LASTDRIVE=Z E default (use with SUBST) SHELL=file for your own command processor DEVICE=ANSI.SYS driver for ANSI graphics (see PROMPT) DEVICE=DRIVER.SYS install unusual disk drive /D:drive # (0-255) /T:tracks per side (1-999) /S:sec per trk (1-99) /F:device type # (0-2) /H:# of heads (1-99) /N - fixed disk DEVICE=VDISK.SYS bs ss ds install RAM disk drive bs=buffer size (64K) ss=sector size (128) ds=dir size (64) /E:max sectors transferred (8) use with Extended Memory .BAT Files ========== BREAK ON or OFF enable/disable Ctrl-Break/Ctrl-C VERIFY ON or OFF automatic verify when COPY is used ECHO ON or OFF toggle message display on/off ECHO message display message REM message display message (w/REM displaying) PAUSE message display message & pause execution SET string1=string2 reassign environment names that are used SET COMSPEC=C:\ looks for COMMAND.COM in drive C: EXAMPLE.BAT using replaceable parameters (%0 - %9) TYPE %1 typing EXAMPLE YOUR.DOC SET FILE2=MY.DOC displays the file YOUR.DOC TYPE %FILE2% displays the file MY.DOC SHIFT delete %0 value, move %1-%9 up one slot FOR %%V IN (files) DO command assign files to a variable (A-Z) FOR %%V IN (*.DOC) DO TYPE %%V display contents of all *.DOC files IF or IF NOT condition command conditional processing of commands ERRORLEVEL # FORMAT BACKUP RESTORE set error level # string1==string2 EXIST file GOTO label transfer to another part of batch file :label :comment can be used for documentation Directory Commands ================== DIR display the filenames on a disk /P ..... pause each screen /W ...... display 5 names across MKDIR or MD name or \name make a new directory (\ starts at root) CHDIR or CD name or \name change the current directory CD .. go to parent directory CD \ go to root directory RMDIR or RD name or \name delete existing directory (must be empty) PATH \subdir1;\subdir2;\subdir3 search each subdirectory for commands TREE /F show each subdir & files TREE /V show each subdir & files & stats Disk Commands ============= VER display DOS version FDISK menu for partitioning hard drive FORMAT drive prepare disk for storage /S ..... copies OS /V ...... volume name /B ...... room for OS /1 ..... single sided /8 ...... 8 sectors /4 ...... 360 on 1.2 /Txx ... tracks per side /Nxx .... sectors per track SYS drive copy OS (2 files) to disk VOL display volume name of disk LABEL volumename add/change volume name of disk ATTRIB switch file change Read-Only attribute of file +R ..... make Read-Only -R ...... make Read-Write CHMOD switch file change all the attributes of file + A(rchive) H(idden) R(ead-only) S(ystem) sets the attribute bit - A(rchive) H(idden) R(ead-only) S(ystem) resets the attribute bit APPEND drive1\path1;drive2\path2 set a search path for files across drives type APPEND first if using ASSIGN ASSIGN drive1=drive2 (no colons) accesses to drive1 will now go to drive2 XASSIGN drive1=drive2 accesses to name1 will now go to name2 file1=file2 path1=path2 /D ..... remove assignment /L ...... list assignment JOIN drive1 drive2\newpath accesses to newpath will now go to drive1 /D ..... remove joining newpath must be empty SUBST drive path assign a drive letter to a subdirectory /D ..... remove substitution be sure to change LASTDRIVE CHKDSK drive or file check integrity of disk /F ..... correct errors /V ...... display messages RECOVER drive or file try to recover lost or bad data BACKUP drive1:files drive2 backup files on disk (files are packed) /S ..... include subdir /M ...... only modified files /A ...... add files /D:mm-dd-yy (after date) /T:hh-mm-ss (after time) /L ...... create log RESTORE drive1 drive2 restore files to disk /S ..... include subdir /M ...... only modified files /N ...... new files /B or /A:mm-dd-yy (by date) /E or /L:hh-mm-ss (by time) /P ...... OK prompt DISKCOPY drive1 drive2 copy entire disk (by track) /1 ..... single sided DISKCOMP drive1 drive2 compare two disks (by track) /1 ..... single sided /8 ...... 8 sectors COPY file1 file2 or f1+f2 file3 copy entire files *.ext file3 or *.ext1+*.ext2 *.ext3 or ALL.DOC+*.DOC (to ALL.DOC) /V ..... verify copy /A ...... ASCII file /B ...... binary file XCOPY drive1 drive2 enhanced version of COPY /A ..... archive, bit set /M ...... archive, bit reset /E ...... copy subdir /S ..... copy lower subdir /P ...... OK prompt /W ...... wait prompt /V ..... verify copy /D:mm-dd-yy (after date) COMP file1 file2 compare two files FC switch file1 file2 enhanced version of COMP /a ..... show beg/end lines /n ...... show line # /lb# .... max lines /l ..... ASCII files /b ...... byte by byte /# ...... # for match /t ..... tabs =/ 8 spaces /w ...... compress spaces /c ...... ignore case REPLACE files drive replace previous versions of files /A ..... add new files /S ...... replace same files /R ...... read-only /P ..... OK prompt /W ...... wait prompt RENAME or REN file1 file2 change the name of a file ERASE or DEL file delete a file SIZE drive or file display file size and disk space needed TYPE file display contents of an ASCII file PRINT file buffer printing from disk /D:printer device (PRN) /B:buffer size (512) /Q:queue size (10) /U:busy tick to wait (1) /M:max tick to print (2) /S:time slice (8) /T delete queue /C cancel printing /P begin printing SHARE for sharing files on a network /F:space (2048) /L:locks (20) ******************************************************************************** * FORMAT DISKCOPY DISKCOMP BACKUP RESTORE LABEL PRINT should not be used if * * ASSIGN XASSIGN JOIN SUBST are in affect (use /D to remove) * ******************************************************************************** MODE & CONFIGUR Commands ======================== MODE 40 or 80 or BW40 or BW80 or CO40 or CO80 or MONO, R or L, T screen type, shift 1 position, show test pattern CONFIGUR SCREEN C foreground background width or M character width first 3 letters 40 or 80 n=normal r=reverse MODE COM#:baud, parity, data bits, stop bits, P (printer retry) baud=110-9600 parity=N,E,O data=7,8 stop=1,2 port=Xon,Etx,None CD-RTS=Low,Hi,Ign CONFIGUR PORT # baud stop bits data bits parity port CD CTS DTR RTS MODE LPT#:=COM# LPT# - 1,2,3 COM# - 1,2 CONFIGUR REROUTE logical=assign logical - LPT1,2,3 COM1,2 assign - PAR1 SER1,2 MODE LPT#:80 or 132, 6 or 8, P (retry on error for printer) Filter Commands =============== FIND switch "string" file find a string in a file /V ..... show lines not in /C ...... count of lines /N ...... show line # SORT switch fileout sort a file (filein=/fileout) /R ..... reverse order /+n ..... start at column n MORE