DOS (Disk Operating System) is like some tough old geezer who never seems to die.

  • Access DOS from the Window OS via Start, then Run, then command or cmd.
  • The two wild card characters in DOS are * for zero or more characters and ? for one character.
  • For long name with quotes, use the short name equivalent or enclose the name in double quotes.
  • Switches come after the parameters. EG: del myfile.txt /p.
  • Switches may also have parameters. EG: dir /a d.
  • Switches and their parameters may be prefixed to indicate opposite. EG: dir /a -d.
  • Options come before the parameters.
  • Instead of outputting to the screen, you can output to a file. EG: dir /s > dir.txt.
  • You can append the output to a file. EG: tree /f >> tree.txt.
  • Get help with variations such /?, /?, or help. EG: tree /?.
cd NewDir
Change Directory.
If the input is .., then this moves to the parent directory.
If the input is ..., then this moves to the grandparent directory.
If the input is \, then this moves to the root directory of the current drive.
To change the drive, simply type in something like d:, i.e. you don't even need the cd
cls
CLear Screen.
copy SourceFile DestinationFile
COPY a file. If a file is prefixed with /A, then the file is an ASCII text file. If the file is prefixed with /B, then the file is a binary file. Files may be concatenated into a single single file by using wildcards in source file (EG: copy c:*.txt alldocs.txt) or a + between each file in the source file (EG: copy /B a.txt+b.txt e:c.txt).
/v verifies that the copy was correctly copied.
/y and /-y suppresses (or forces) the prompt which confirms that you want to overwrite a preexisting destination file.
del FileToDelete
DELetes a file.
/p prompts for confirmation to do the delete.
deltree
DELete a TREE. Deletes a directory and all of its subdirectories and files. For DOS 5+.
/y
suppresses the prompt which confirms that you want to overwrite a preexisting destination file.
dir directory
DIRectory. This lists contents of the current directory.
/a show or don't show items with indicated Attributes: d (Directory), r (Read-only), h (Hidden), a (Archival), s (System). EG: /a d-a.
/b show Bare format, i.e. no heading or summary.
/l Lowercase output.
/o Order items by item indicated: n (Name, alphabetic), s (Size, smallest first), e (Extension, alphabetic), d (Date and time, earliest first), g (Group, directories first), a (last Access date, earliest first). EG: /o -n.
/p Pauses between pages of info.
/s Subdirectories, i.e. list for current directory and Subdirectories.
/v Verbose mode.
/w
show Wide list format, i.e. multiple columns.
edit file
Enables a user to EDIT, view, or create files with a primitive text editor. The maximum file size is 65,280 lines. Hit CTRL+z then ENTER to save the file. Hit ALT to access the menu. For DOS 5+.
/
nnn load binary file(s), wrapping lines to nnn characters wide.
/? displays this help screen.
/b
forces black & white or monochrome mode.
/h displays the maximum number of lines possible for your Hardware.
/r load file(s) in Read-only mode.
/s forces the use of Short filenames.
fdisk
Formats hard DISKs. More possibilities than listed here.
/mbr fills the first 446 bytes of the Master Boot Record (the first 512 bytes) with zeros.
/status display status, i.e. partition info.
/x ignores eXtended disk-access support.
format
FORMATs and erases disks or drives.
/1 formats 1 side of a floppy disk.
/4 formats a 5.25-inch 360K floppy disk in a high-density drive.
/8 formats 8 sectors per track.
/b allocates space on the formatted disk for system files.
/c tests Clusters that are currently marked "bad."
/f:size
specifies the size of the Floppy disk to format (egs: 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).
/n:sectors specifies the Number of sectors per track.
/s copies System files to the formatted disk.
/t:tracks specifies the number of Tracks per disk side.
/q performs a Quick format.
/v:label specifies the Volume label.
mkdir
MaKe DIRectory. Also md.
more
Displays MORE info one page at a time. Usually used in a pipeline format.
dir | more Shows the contents of the directory one page at a time.
Here are some of the commands available at the -- More -- prompt: RETURN display next line
SPACE display next page
= display line number
Q quit
move SourceFile DestinationFile
MOVE or move and rename a file.
/y and /-y suppresses (or forces) the prompt which confirms that you want to move the file.
net
Update, fix or view the NETwork or network settings. Too many options to list here. EG: To map a network drive: net.exe use P: \\10.0.0.78\c$\myDir myPassword /user:myDomain\myUserName.
path=PathList
Specifies what PATHs DOS will look in when trying to run a command. path will show the current path. path; will clear the current path. Typical systems are set as follows:
path=c:\windows\command for Windows 95/98.
path=c:\WINNT;c:\WINNT\system32; for Windows NT/2000.
ping destination
Helps check the TCP/IP issues.
-a resolve addresses to hostnames.
-f set don't Fragment flag in packet.
-i TTL Time To Live.
-j host-list loose source route along host-list. Note that the command cannot be issued with both -j and -k.
-k host-list strict source route along host-list.
-l size send buffer size.
-n count number of echo requests to send.
-r count record route for count hops.
-s count timestamp for count hops.
-t pings the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C.
-v TOS Type Of Service.
-w timeout timeout in milliseconds to wait for each reply.
ren OldFileName NewFileName
REName a file that stays in its current directory. EG: ren * _*. This prefixes all files with an underscdore.
rmdir
ReMove empty DIRectory. Also rd.
/S removes files and directories in the current directory, plus subdirectories and subfiles.
type FileToDisplay
Display the content of a file or files.
xcopy source destination
eXtra powerful COPY. Copies whole trees.
/a copies files with the Archive attribute set, doesn't change the attribute. /m copies files with the archive attribute set, turns off the archive attribute.
/c Continues copying even if errors occur.
/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.
/e copies directories and sub directories, including Empty ones. Same as /s /e. May be used to modify /t.
/f displays Full source and destination file names while copying.
/h copies Hidden and system files also.
/i if destination does not exist and copying more than one file, assumes that destination must be a directory.
/k copies attributes. Normal xcopy will reset read-only attributes.
/l displays files that would be copied.
/n copy using the generated short Names.
/p
Prompts you before creating each destination file.
/q does not display file names while copying.
/r overwrites Read-only files.
/s copies directories and Sub directories except empty ones.
/t creates directory structure, but does not copy files. Does not include empty directories or sub directories. /t /e includes empty directories and sub directories.
/u Updates the files that already exist in destination.
/w prompts you to press a key before copying.
/y overwrites existing files without prompting. /-y prompts you before overwriting existing files.

FTP in DOS

c:\>ftp
c:\>ftp somesite.com
c:\>ftp 22.22.22.22
ftp> open somesite.com
ftp> open 22.22.22.22
ftp> ?       #Gets help
ftp> help    #Gets help
ftp> cd changedir
ftp> put PutThisFile.txt   #same as send
ftp> get GetThisFile.txt   #same as recv
ftp> delete DeleteThisFile.txt
ftp> rename RenameThisFile.txt NewName.txt
ftp> mkdir MakeThisDir
ftp> rmdir RemoveThisDir
ftp> dir    #Lists contents of remote dir
ftp> pwd    #Print working dir on remote machine
ftp> !      #Escapes to local shell
c:\>dir   #Lists contents of local dir
c:\>exit  #Exits local shell and returns to remote ftp session
ftp> binary  #Set binary transfer type
ftp> ascii   #Set ascii transfer type
ftp> disconnect  #disconnects from remote machine


GeorgeHernandez.comSome rights reserved