DOS Commands Cheat-Sheet
Basic Commands in DOS
-
attrib : Change the attributes of a file. Use this to hide files. Use following switches:
+h : Make files hidden
-h : Make hidden files visible.
-
dir : List all the files in a directory. Takes following switches:
/d : List files alphabetically using multiple columns instead of one long list.
/og : List with all the directories first.
/p : Pause at the end of a screen. Use with really long lists.
/w : List in multiple columns (wide mode).
Example: dir /d /og /p
-
cd directory : Move into a different directory (change directory). Can use any valid directory or one of the following special codes:
cd .. : Change into the parent for this directory.
cd \ : Change into the root directory for this drive.
-
mkdir directory_name : Make a new directory
-
copy oldfile newfile : Copy a file from one place to another.
-
rename filename newfilename : Change the name of a file.
-
del filename : Delete a file. Can also use the DOS command "erase" to do exactly the same thing. Takes the following switches:
/q : Quiet mode. Don't ask me if I really want to delete the file or not.
-
rmdir directory : Delete a directory. The directory must be empty before you can use this command. Use following switches:
/s : Remove all files and subdirectories. Use this when directory is not empty.
/q : Quiet mode. Don't ask if I really want to delete stuff.
-
/? : This is the "help" switch. Add it to the end of any DOS command and DOS will give you some directions on how to use the command you typed in.
Wild Cards
"Wildcards" are special characters used in DOS that basically mean "anything can be here".
? : Any one character can be here.
dir game?.gam will display all the files named game_.gam (where the underline can be any character at all).
* : Anything can be here, no matter how many characters.
dir g*.* will display all the files that start with "g".
Example
If the following files are in a directory:
game1.gam
game2.gam
gamex.gam
game23.gam
game_old.gam
good_stuff.txt
cipher_code.txt
Then ...
dir game?.gam ==> "game1.gam , game2.game , gamex.gam"
dir game*.gam ==> "game1.gam , game2.gam , gamex.gam, game23.gam , game_old.gam"
dir *.txt ==> "good_stuff.txt , cipher_code.txt"
File Extensions
In Windows / DOS, the letters of a filename after the period are called the "extension". Windows uses this extension to determine which program is associated with a file. Changing these last three letters will usually change the icon displayed for that file, and make Windows try to open that file in a different program.
Some common file extensions are ...
-
.bat : Stands for "batch file". This file is a set of DOS commands stored in a text file and ready to be run.
-
.doc : Stands for "document". This is a Microsoft Word file.
-
.exe : Stands for "executable file" and means that the file is actually a program that can be run by itself.
-
.jpg : A type of picture file (ours are set to open with GIMP, so we get the GIMP icon). Other picture file extensions include .bmp, .gif, and .png.
-
.txt : Stands for "text". This is a plain text file made in Notepad or another text editor, not a Microsoft Word file.
-
.zip : A zipped, or compressed, file.
Restricted access |