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
- 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
- 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
- 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).
/vverifies that the copy was correctly copied.
/-ysuppresses (or forces) the prompt which confirms that you want to overwrite a preexisting destination file.
DELetes a file.
/pprompts for confirmation to do the delete.
DELete a TREE. Deletes a directory and all of its subdirectories and files. For DOS 5+.
suppresses the prompt which confirms that you want to overwrite a preexisting destination file.
DIRectory. This lists contents of the current directory.
/ashow or don't show items with indicated Attributes:
/bshow Bare format, i.e. no heading or summary.
/oOrder items by item indicated:
s(Size, smallest first),
d(Date and time, earliest first),
g(Group, directories first),
a(last Access date, earliest first). EG:
/pPauses between pages of info.
/sSubdirectories, i.e. list for current directory and Subdirectories.
show Wide list format, i.e. multiple columns.
Enables a user to EDIT, view, or create files with a primitive text editor. The maximum file size is 65,280 lines. Hit
ENTERto save the file. Hit
ALTto access the menu. For DOS 5+.
nnnload binary file(s), wrapping lines to
/?displays this help screen.
/hdisplays the maximum number of lines possible for your Hardware.
/rload file(s) in Read-only mode.
/sforces the use of Short filenames.
Formats hard DISKs. More possibilities than listed here.
/mbrfills the first 446 bytes of the Master Boot Record (the first 512 bytes) with zeros.
/statusdisplay status, i.e. partition info.
/xignores eXtended disk-access support.
FORMATs and erases disks or drives.
/1formats 1 side of a floppy disk.
/4formats a 5.25-inch 360K floppy disk in a high-density drive.
/8formats 8 sectors per track.
/ballocates space on the formatted disk for system files.
/ctests Clusters that are currently marked "bad."
/n:sectorsspecifies the Number of sectors per track.
/scopies System files to the formatted disk.
/t:tracksspecifies the number of Tracks per disk side.
/qperforms a Quick format.
/v:labelspecifies the Volume label.
MaKe DIRectory. Also
Displays MORE info one page at a time. Usually used in a pipeline format.
dir | moreShows the contents of the directory one page at a time.
Here are some of the commands available at the
-- More --prompt:
RETURNdisplay next line
SPACEdisplay next page
=display line number
move SourceFile DestinationFile
MOVE or move and rename a file.
/-ysuppresses (or forces) the prompt which confirms that you want to move the file.
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.
Specifies what PATHs DOS will look in when trying to run a command.
pathwill show the current path.
path;will clear the current path. Typical systems are set as follows:
path=c:\windows\commandfor Windows 95/98.
path=c:\WINNT;c:\WINNT\system32;for Windows NT/2000.
Helps check the TCP/IP issues.
-aresolve addresses to hostnames.
-fset don't Fragment flag in packet.
-i TTLTime To Live.
-j host-listloose source route along host-list. Note that the command cannot be issued with both
-k host-liststrict source route along host-list.
-l sizesend buffer size.
-n countnumber of echo requests to send.
-r countrecord route for count hops.
-s counttimestamp for count hops.
-tpings the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C.
-v TOSType Of Service.
-w timeouttimeout 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.
ReMove empty DIRectory. Also
/Sremoves files and directories in the current directory, plus subdirectories and subfiles.
- Display the content of a file or files.
xcopy source destination
eXtra powerful COPY. Copies whole trees.
/acopies files with the Archive attribute set, doesn't change the attribute.
/mcopies files with the archive attribute set, turns off the archive attribute.
/cContinues copying even if errors occur.
/d:datecopies 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.
/ecopies directories and sub directories, including Empty ones. Same as
/s /e. May be used to modify
/fdisplays Full source and destination file names while copying.
/hcopies Hidden and system files also.
/iif destination does not exist and copying more than one file, assumes that destination must be a directory.
/kcopies attributes. Normal xcopy will reset read-only attributes.
/ldisplays files that would be copied.
/ncopy using the generated short Names.
/qdoes not display file names while copying.
/roverwrites Read-only files.
/scopies directories and Sub directories except empty ones.
/tcreates directory structure, but does not copy files. Does not include empty directories or sub directories.
/t /eincludes empty directories and sub directories.
/uUpdates the files that already exist in destination.
/wprompts you to press a key before copying.
/yoverwrites existing files without prompting.
/-yprompts you before overwriting existing files.
FTP in DOS
c:\>ftp c:\>ftp somesite.com c:\>ftp 22.214.171.124 ftp> open somesite.com ftp> open 126.96.36.199 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