Temple College Logo R. Craig Collins > Common > DOS Commands

DOS Commands © R. Craig Collins, 2005

Directories and Files
Path [drive:\][directory\]filename.ext (8.3)
Directory (Folder) Commands
List contents dir
Show structure tree /f
Change directory focus (open another folder) cd foldername
Make a new directory md foldername
Remove an empty directory rd foldername
Delete directories, subdirectories, and files deltree foldername
File Commands
Copy files copy source destination
  »Example copy a:\test.txt a:\class\test.txt
  »Example, destination renamed copy a:\test.txt a:\class\test.ltr
  »Example, copy all text (.txt) files, regardless of file name copy a:\*.txt a:\class\*.txt
  »Example, copy all files named homework, regardless of extension copy a:\homework.* a:\class\homework.*
  »Example, copy all files copy a:\*.* a:\class\*.*
  »Example, create a text file copy con filename.ext
Copy files and folders xcopy source destination /e
  »Example, copy all files, folders, and subdirectories xcopy a:\*.* c:\backup /e
Copy a diskette diskcopy source destination
  »Example diskcopy a: a:
Move a file to a different folder move source destination
Delete a file del filename.ext
Undelete a file undelete filename.ext
Set an attribute of a file attrib action (±) target file
  »Example attrib +h a:\class\test.txt
Rename a file ren oldname newname
Batch Files
set the Prompt prompt $p$g
set the Path to DOS path c:\DOS
insert a comment rem note to me
wait to continue pause
display echo "this will display"
arrange files to a faster loading, contiguous state defrag
check for and repair, errors chkdsk or scandisk
copies information for safekeeping backup