In this tutorial, we're going to talk about more essential commands to know in DOS. We're going to get a little more loose with the syntax in this tutorial so knowledge of the bare essentials is key in fully understanding this new loose syntax.

Revised Syntax

In previous tutorials, we've typed the path to files long hand. For example:

C:\Users\Dennis> cd C:\users\dennis\documents\downloads

Note: For the differences between the three filing systems, please click here.

This is meant to under stand the syntax of the path and used to learn how the files are structured in XP, Vista, and Windows 7. The short hand version assumes that knowledge of the "file tree" is known and understood easily. The short-hand notation saves time and makes navigating through DOS more efficient. Short-hand notation is like the following:

C:\Users\Dennis> cd music
C:\Users\Dennis> cd C:\users\dennis\music

Both of these examples will take us to the same destination. The only difference is that the latter example provides the entire path to the destination (which is somewhat redundant) and the first example already assumes we're talking about a Music directory that exists in the path C:\users\dennis.


Being graced with this "revised syntax" we can now commence and learn more commands in DOS! Our first command is an extremely useful command: copy. The most widely used command once upon a time but has been eclipsed by xcopy which has been succeeded by robocopy (Vista and 7 only).

The copy command is slightly more complex then any other command that we've gone over so far. There are more switches that can be used to dictate how the command executes and we need to write two paths. The syntax is as follows:

C:\> Copy [switches] source [switches] [drive]

path] destination [switches] [drive]


C:\> Copy *.* d:
C:\Users\Dennis\test copy stuff.txt C:\users\dennis\desktop

The first command will copy all files in the current directory to the D: drive. This is an unsophisticated way of creating backups of files and folders.

The second example is copying the file from the directory C:\users\dennis\test to C:\users\dennis\desktop.

Useful Switches

The copy command comes with useful switches that all us to define what type of file we are copying and what actions we want to take once the file is copied.

Switches Description
Source Switches There are two separate switches for source and destination
/A Indicates that the file is an ASCII Text File
/B Indicated that the file is a Binary File
Destination Destination Switches
/V Verifies that the copy was successful and done correctly.
/N Uses a short filename, if available, when copying a non-8-dot 3 name.
/Y Suppresses prompting to confirm that you want to overwrite an existing destination file.
/-Y Causes prompting to confirm that you want to overwrite an existing destination file. The prefix (-) means "not" in most cases.

Cool Copy Tricks

There are two cool tricks that stand out with the copy command. The first:

C:\> copy con stuff.txt
This is some text^Z
1 file(s) copied.

The copy command when combined with con allows us to create a text file that we want to copy to the directory. the ^Z is done by pressing control+z, this saves and exits. Though, an easier way is to use the edit command.

The second trick is equally as cool and makes sense if you know xcopy or robocopy (Vista and 7 only). This trick will actually allow us to combine the contents of two files together. For example:

C:\users\dennis\test> copy stuff.txt+more-stuff.txt

This will copy the contents of more-stuff.txt and combine it with stuff.txt We can verify that the copy was successful by using the type command to view the contents of the .txt file.

Be Sociable, Share!