Vous êtes sur la page 1sur 48

Contents

Microsoft DOS cls command ................................................................................................................................... 4


About cls................................................................................................................................................................... 4
Availability................................................................................................................................................................ 4
Syntax ....................................................................................................................................................................... 4
Examples .................................................................................................................................................................. 4
Microsoft DOS mklink command ...................................................................................................................................... 4
About mklink................................................................................................................................................................ 4
Availability ................................................................................................................................................................... 4
Syntax .......................................................................................................................................................................... 4
Examples ................................................................................................................................................................... 5
How do I delete a symbolic link? .................................................................................................................................. 6
Microsoft DOS cd command .................................................................................................................................... 6
About cd ................................................................................................................................................................... 6
Availability................................................................................................................................................................ 6
Syntax ....................................................................................................................................................................... 6
If Command Extensions are enabled CHDIR changes as follows: ............................................................. 6
Windows 98 and earlier syntax .......................................................................................................................... 7
Examples .................................................................................................................................................................. 7
Microsoft DOS dir command ................................................................................................................................... 8
About dir................................................................................................................................................................... 8
Availability................................................................................................................................................................ 8
Syntax ....................................................................................................................................................................... 8
Microsoft Windows 95, 98, and ME syntax ....................................................................................................10
Examples .................................................................................................................................................................11
Microsoft DOS md and mkdir command..........................................................................................................................13
About md and mkdir ............................................................................................................................................13
Availability...............................................................................................................................................................13
Syntax ......................................................................................................................................................................13
Examples .................................................................................................................................................................14
Microsoft DOS rd and rmdir command ............................................................................................................................14
About rd and rmdir ...............................................................................................................................................14
Availability...............................................................................................................................................................15
Syntax ......................................................................................................................................................................15

Examples .................................................................................................................................................................15
Microsoft DOS move command .............................................................................................................................16
About move .............................................................................................................................................................16
Availability...............................................................................................................................................................16
Syntax ......................................................................................................................................................................16
Examples .............................................................................................................................................................17
Microsoft DOS copy command...............................................................................................................................17
About copy ..............................................................................................................................................................18
Availability...............................................................................................................................................................18
Windows Vista and later syntax ........................................................................................................................18
Windows XP and earlier syntax .........................................................................................................................19
Examples.................................................................................................................................................................20
Microsoft DOS xcopy command ......................................................................................................................................21
About xcopy ................................................................................................................................................................21
Availability ..................................................................................................................................................................21
Syntax .........................................................................................................................................................................21
Windows 98 and older syntax .....................................................................................................................................24
Examples.................................................................................................................................................................25
Questions and answers ...............................................................................................................................................26
Microsoft DOS robocopy command ................................................................................................................................27
About robocopy ..........................................................................................................................................................27
Availability ..................................................................................................................................................................27
Syntax .........................................................................................................................................................................27
Copy options ...............................................................................................................................................................27
File Selection Options ..................................................................................................................................................30
Retry Options ..............................................................................................................................................................31
Logging Options ..........................................................................................................................................................31
Examples.................................................................................................................................................................33
Microsoft DOS edit command ................................................................................................................................34
About edit ................................................................................................................................................................34
Availability...............................................................................................................................................................35
Syntax ......................................................................................................................................................................35
Examples .............................................................................................................................................................36
Using edit to create a file .....................................................................................................................................36
Additional information .........................................................................................................................................37

Microsoft DOS del command ..........................................................................................................................................39


About del ....................................................................................................................................................................39
Availability ..................................................................................................................................................................39
Syntax .........................................................................................................................................................................39
Windows 2000 and Windows XP recovery console syntax ...........................................................................................40
Windows 95, 98, and ME syntax ..................................................................................................................................40
Examples.................................................................................................................................................................41
Microsoft DOS attrib command .......................................................................................................................................42
About attrib.............................................................................................................................................................42
Availability ..................................................................................................................................................................42
Syntax .........................................................................................................................................................................42
Examples .................................................................................................................................................................45
Extended information...........................................................................................................................................47
Additional information .....................................................................................................................................48

Microsoft DOS cls command


About cls
Cls is a command that allows a user to clear the complete contents of the screen and leave
only a prompt.

Availability
The cls command is an internal command and is available in the below Microsoft operating
systems.

Syntax
CLS

Examples
cls

Running the cls command at the command prompt would clear your screen of all previous
text and only return the prompt.

Microsoft DOS mklink command


About mklink
Creates a symbolic link.

Availability
The mklink command is an internal command that is available in the below Microsoft
operating systems.

Syntax
MKLINK [[/D] | [/H] | [/J]] Link Target
/D

Creates a directory symbolic link. Default is a file symbolic link.

/H

Creates a hard link instead of a symbolic link.

/J

Creates a Directory Junction.

Link

specifies the new symbolic link name.

Target

specifies the path (relative or absolute) that the new link refers to.

Examples
Note: the mklink command requires you to be in an elevated command prompt.
mklink /d \Docs \Users\Hope\Documents

The above example command would create a symbolic link called "Docs" to the
\Users\Hope\Documents directory, even if the directory does not exist. If created
successfully you will see a message similar to the example shown below.
symbolic link created for \Docs <<===>> \Users\Hope\Documents
Once the Symbolic link has been created using the dir command you can see any
symbolic link in the directory listing of where the symbolic link was created. Below is an
example of what the above symbolic link directory <SYMLINKD> would look like in the
command line.

To get into the symbolic link directory you would treat it like any other directory and use
the cd command. To get into the Docs directory you would type "cd docs" at the prompt.

How do I delete a symbolic link?


To delete a symbolic link treat it like any other directory or file. If you created a symbolic
link using the command shown above, move to the root directory since it is "\Docs" and
use the rmdir command. If you created a symbolic link <SYMLINK> of a file to delete a
symbolic link use the del command.
Tip: When you delete a symbolic link you are just deleting the link the file or directory that
exists elsewhere on the computer does not get deleted.

Microsoft DOS cd command


About cd
CD (Change Directory) is a command used to switch directories in MS-DOS and the
Windows command line.

Availability
The CD command is an internal command and is available in the below Microsoft operating
systems.

Syntax
Windows XP and later syntax
CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]
.. Specifies that you want to change to the parent directory.
Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.
Use the /D switch to change current drive in addition to changing current directory for a
drive.

If Command Extensions are enabled CHDIR changes as follows:


The current directory string is converted to use the same case as the on disk names. So CD
C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, to CD into a subdirectory name that
contains a space without surrounding the name with quotes. For example:
chdir \winnt\profiles\username\programs\start menu

is the same as:


cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.

Windows 98 and earlier syntax


CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]

Examples
cd\
Goes to the highest level, the root of the drive.
cd..

Goes back one directory. For example, if you are within the C:\Windows\COMMAND>
directory, this would take you to C:\Windows>
Windows 95, 98, and later versions have a feature in the CD command that allows you to
go back more than one directory when using the dots. For example, typing: cd... with
three dots after the cd would take you back two directories.
cd windows

If present, would take you into the Windows directory. Windows can be substituted with
any other name.
cd\windows

If present, would first move back to the root of the drive and then go into the Windows
directory.

cd\windows\system32

If present, would move into the system32 directory located in the Windows directory. If at
any time you need to see what directories are available in the directory you're currently in
use the dir command.
cd /d e:\pics

If for example you were on the C: drive, typing the above command with the /d option
would first switch the E: drive letter and then move into the pics directory.
cd

Typing cd alone will print the working directory. For example, if you're in c:\windows> and
you type the cd it will print c:\windows. For those users who are familiar with Unix or
Linux this could be thought of as doing the pwd (print working directory) command.

Microsoft DOS dir command


About dir
The dir command allows you to see the available files and directories in the current
directory. In addition to listing the contents of a directory, the dir command also shows the
last modification date and time, as well as the file size.

Availability
The dir command is an internal command and is available in the below Microsoft operating
systems.

Syntax
Microsoft Windows 2000, XP, Vista, 7, and 8 syntax
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P]
[/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]

Specifies drive, directory, or files to list.

/A

Displays files with specified attributes.

attributes

D Directories

R Read-only files

H Hidden files

A Files ready for archiving

S System files

I Not content indexed files

L Reparse Points

- Prefix meaning not

/B

Uses bare format (no heading information or summary).

/C

Display the thousand separator in file sizes. This is the default.


Use /-C to disable display of separator.

/D

Same as wide but files are list sorted by column.

/L

Uses lowercase.

/N

New long list format where filenames are on the far right.

/O

List by files in sorted order.

sortorder

N By name (alphabetic) S By size (smallest first) E By extension


(alphabetic) D By date/time (oldest first) G Group directories
first - Prefix to reverse order

/P

Pauses after each screenful of information.

/Q

Display the owner of the file.

/R

Display alternate data streams of the file.

/S

Displays files in specified directory and all subdirectories.

/T

Control what time field displayed or used for sorting

timefield

C Creation
A Last Access
W Last Written

/W

Uses wide list format.

/X

This displays the short names generated for non-8dot3 file


names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.

/4

Displays four-digit years

Microsoft Windows 95, 98, and ME syntax


Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]] [/O[[:]sortorder]] [/S] [/B] [/L] [/V]
[drive:][path][filename]

Specifies drive, directory, or files to list. (Could be enhanced


file specification ormultiple filespecs.)

/P

Pauses after each screenful of information.

/W

Uses wide list format.

/A

attributes:

D Directories
R Read-only files
H Hidden files
A Files ready for archiving
S System files
- Prefix meaning not
/O

List by files in sorted order, sortorder:


N By name (alphabetic)
S By size (smallest first)
E By extension (alphabetic)
D By date and time (earliest first)
G Group directories first
- Prefix to reverse order
A By Last Access Date (earliest first)

/S

Displays files in specified directory and all subdirectories.

/B

Uses bare format (no heading information or summary).

/L

Uses lowercase.

/V

Verbose mode.

Switches may be preset in the DIRCMD environment variable. Override preset switches by
prefixing any switch with - (hyphen)--for example, /-W.

Examples
dir

Lists all files and directories in the directory that you are currently in. By default the dir
command will list the files and directories in alphabetic order.
dir *.exe

The above command lists any file that ends with the .exe file extension. See the wildcard
definition for further wildcard examples.
dir *.txt *.doc

The above is using multiple filespecs to list any files ending with .txt and .doc in one
command.
dir /ad

List only the directories in the current directory. If you need to move into one of the
directories listed use the cd command.
dir /s

Lists the files in the directory that you are in and all sub directories after that directory, if
you are at root "C:\>" and type this command this will list to you every file and directory on
the C: drive of the computer.
dir /p

If the directory has lots of files and you cannot read all the files as they scroll by, you can
use this command and it displays all files one page at a time.
dir /w

If you don't need the info on the date or time and other information on the files, you can
use this command to list just the files and directories going horizontally, taking as little as
space needed.
dir /s /w /p

This would list all the files and directories in the current directory and the sub directories
after that, in wide format and one page at a time.
dir /on

List the files in alphabetical order by the names of the files.


dir /o-n

List the files in reverse alphabetical order by the names of the files.
dir \ /s |find "i" |more

A nice command to list all directories on the hard drive, one screen page at a time, and see
the number of files in each directory and the amount of space each occupies.
dir > myfile.txt

Takes the output of dir and re-routes it to the file myfile.txt instead of outputting it to the
screen.

Microsoft DOS md and mkdir command


About md and mkdir
Allows you to create your own directories in MS-DOS.
Availability
The md and mkdir commands are internal commands that are available in the below
Microsoft operating systems.
Syntax
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
If Command Extensions are enabled MKDIR changes as follows:

MKDIR creates any intermediate directories in the path, if needed.


For example, assume \a does not exist then:
mkdir \a\b\c\d
is the same as:
mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d
which is what you would have to type if extensions were disabled.
Examples
md test

The above example creates the "test" directory in the current directory.
mkdir "computer hope"

The above command would create a directory called "computer hope", if you want a space
in your directory name it must be surrounded in quotes.
md c:\test

Create the "test" directory in the c:\ directory.

Microsoft DOS rd and rmdir command


About rd and rmdir
Removes an empty directory in MS-DOS. To delete directories with files or directories within
them the user must use the deltree command, or if you are running Microsoft Windows
2000 or Windows XP use the /S option.

Availability
The rd and rmdir commands are internal commands and are available in the below
Microsoft operating systems.

Syntax
Windows XP and later syntax
Windows 95, 98, and ME syntax
Windows XP and later syntax
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S

Removes all directories and files in the specified directory in addition to the
directory itself. Used to remove a directory tree.

/Q

Quiet mode, do not ask if ok to remove a directory tree with /S.

Windows 95, 98, and ME syntax


Removes (deletes) a directory.
RMDIR [drive:]path
RD [drive:]path

Examples
rmdir c:\full

If a directory contains files or folders when attempting to delete the directory you will
receive "The directory is not empty." error message. If you want to delete directories that are
full, use the deltree command or if you're using Windows 2000 or later use the example
below with the /s switch.
rmdir c:\test

Remove the test directory, if empty.


rmdir c:\test /s

Windows 2000, Windows XP and later versions of Windows can use this option with a
prompt to permanently delete the test directory and all subdirectories and files. Adding the
/q switch would suppress the prompt.

Microsoft DOS move command


About move
Allows you to move files or directories from one folder to another, or from one drive to
another.
Availability
The move command is an internal command that is available in the below Microsoft
operating systems.
Syntax
Moves files and renames files and directories.
To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
[drive:][path]filename1

Specifies the location and name of the file or files you want to
move.

destination

Specifies the new location of the file. Destination can consist of


a drive letter and colon, a directory name, or a combination. If
you are moving only one file, you can also include a filename if
you want to rename the file when you move it.

[drive:][path]dirname1

Specifies the directory you want to rename.

dirname2

Specifies the new name of the directory.

/Y

Suppresses prompting to confirm you want to overwrite an


existing destination file.

/-Y

Causes prompting to confirm you want to overwrite an existing


destination file.

The switch /Y may be present in the COPYCMD environment variable. This may be
overridden with /-Y on the command line. Default is to prompt on overwrites unless MOVE
command is being executed from within a batch script.
Examples

move c:\windows\temp\*.* c:\temp

Move the files of c:\windows\temp to the temp directory in root, this is of course assuming
you have the windows\temp directory. In this example, *.* is wildcards telling the computer
every file with every extension.
move "computer hope" example

If your directory name has a space, it must be surrounded with quotes, otherwise you will
get a "The syntax of the command is incorrect." error message. In the above example, this
command would move the "computer hope" directory into the example directory contained
in the same directory.
move stats.doc, morestats.doc c:\statistics

The above example would move the files stats.doc and morestats.doc into the c:\statistics
folder.

Microsoft DOS copy command

About copy
Allows the user to copy one or more files to an alternate location.
Availability
The copy command is an internal command and is available in the below Microsoft
operating systems.

Windows Vista and later syntax


COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+
...]] [destination [/A | /B]]
source

Specifies the file or files to be copied.

/A

Indicates an ASCII text file.

/B

Indicates a binary file.

/D

Allow the destination file to be created decrypted.

destination

Specifies the directory or filename for the new file(s).

/V

Verifies that new files are written correctly.

/N

Uses short filename, if available, when copying a file with a non-8dot3


name.

/Y

Suppresses prompting to confirm you want to overwrite an existing


destination file.

/-Y

Causes prompting to confirm you want to overwrite an existing destination


file.

/Z

Copies networked files in restartable mode.

/L

If the source is a symbolic link, copy the link to the target instead of the
actual file the source link points to.

The switch /Y may be preset in the COPYCMD environment variable. This may be
overridden with /-Y on the command line. Default is to prompt on overwrites unless COPY
command is being executed from within a batch script.
To append files, specify a single file for destination, but multiple files for source (using
wildcards or file1+file2+file3 format).

Windows XP and earlier syntax


COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination] [/A | /B]] [/V] [/Y
| /-Y]
source

Specifies the file or files to be copied.

/A

Indicates an ASCII text file.

/B

Indicates a binary file.

destination

Specifies the directory or filename for the new file(s).

/V

Verifies that new files are written correctly.

/Y

Suppresses prompting to confirm you want to overwrite an existing


destination file.

/-Y

Causes prompting to confirm you want to overwrite an existing


destination file.

The switch /Y may be preset in the COPYCMD environment variable. This may be
overridden with /-Y on the command line.
To append files, specify a single file for destination, but multiple files for source (using
wildcards or file1+file2+file3 format).

Examples

copy *.txt c:\

In the above copy command we are using a wildcard to copy all .txt files (multiple files) from
the current directory to the c:\ root directory.
copy *.* a:

Copy all files in the current directory to the floppy disk drive.
Note: If there are hidden files they will not be copied. To copy all files including hidden files
use the xcopy command.
copy autoexec.bat c:\windows

Copy the autoexec.bat, usually found at root, and copy it into the windows directory; the
autoexec.bat can be substituted for any file(s).
copy win.ini c:\windows /y

Copy the win.ini file in the current directory to the windows directory. Because this file
already exists in the windows directory it normally would prompt if you want to overwrite
the file. However, with the /y switch you will not receive any prompt.
copy "computer hope.txt" hope

Copy the file "computer hope.txt" into the hope directory. Whenever dealing with a file or
directory with a space, it must be surrounded with quotes. Otherwise you'll get the "The
syntax of the command is incorrect." error.
copy myfile1.txt+myfile2.txt

Copy the contents in myfile2.txt and combines it with the contents in myfile1.txt.

copy con test.txt

Finally, a user can create a file using the copy con command as shown above, which
creates the test.txt file. Once the above command has been typed in, a user could type in
whatever he or she wishes. When you have completed creating the file, you can save and
exit the file by pressing CTRL+Z, which would create ^Z, and then press enter. An easier
way to view and edit files in MS-DOS would be to use the edit command.

Microsoft DOS xcopy command


About xcopy
Xcopy is a powerful version of the copy command with additional features; has the
capability of moving files, directories, and even whole drives from one location to another.
Tip: Users running recent versions of Windows should also consider
using robocopy.

Availability
The xcopy command is an external command that is available in the below Microsoft
operating systems

Syntax
Windows 2000, XP, and later syntax
Windows 98 and older syntax
Windows 2000, XP, and later syntax
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F]
[/L] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J]
[/EXCLUDE:file1[+file2][+file3]...]
Note: Only Windows Vista and later includes the [/B] and [/J] options.
source

Specifies the file(s) to copy.

destination

Specifies the location or name of new files.

/A

Copies only files with the archive attribute set, doesn't change the
attribute.

/M

Copies only files with the archive attribute set, turns off the archive
attribute.

/D:m-d-y

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.

/EXCLUDE:file1
[+file2][+file3]...

Specifies a list of files containing strings. When any of the strings


match any part of the absolute path of the file to be copied, that file
will be excluded from being copied. For example, specifying a string
like \obj\ or .obj will exclude all files underneath the directory obj or
all files with the .obj extension respectively.

/P

Prompts you before creating each destination file.

/S

Copies directories and subdirectories except empty ones.

/E

Copies directories and subdirectories, including empty ones. Same as


/S /E. May be used to modify /T.

/V

Verifies each new file.

/W

Prompts you to press a key before copying.

/C

Continues copying even if errors occur.

/I

If destination does not exist and copying more than one file, assumes
that destination must be a directory.

/Q

Does not display file names while copying.

/F

Displays full source and destination file names while copying.

/L

Displays files that would be copied.

/H

Copies hidden and system files also.

/R

Overwrites read-only files.

/T

Creates directory structure, but does not copy files. Does not include
empty directories or subdirectories. /T /E includes empty directories
and subdirectories.

/U

Copies only files that already exist in destination.

/K

Copies attributes. Normal Xcopy will reset read-only attributes.

/N

Copies using the generated short names.

/O

Copies file ownership and ACL information.

/X

Copies file audit settings (implies /O).

/Y

Suppresses prompting to confirm you want to overwrite an existing


destination file.

/-Y

Causes prompting to confirm you want to overwrite an existing


destination file.

/Z

Copies networked files in restartable mode.

/B

Copies the Symbolic Link itself versus the target of the link.

/J

Copies using unbuffered I/O. Recommended for very large files.

The switch /Y may be preset in the COPYCMD environment variable.


This may be overridden with /-Y on the command line.

Windows 98 and older syntax


Copies files and directory trees.
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/W] [/C] [/I] [/Q] [/F] [/L]
[/H] [/R] [/T] [/U] [/K] [/N]
source

Specifies the file(s) to copy.

destination

Specifies the location or name of new files.

/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.

/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.

/P

Prompts you before creating each destination file.

/S

Copies directories and sub directories except empty ones.

/E

Copies directories and sub directories, including empty ones. Same as /S


/E. May be used to modify /T.

/W

Prompts you to press a key before copying.

/C

Continues copying even if errors occur.

/I

If destination does not exist and copying more than one file, assumes

that destination must be a directory.


/Q

Does not display file names while copying.

/F

Displays full source and destination file names while copying.

/L

Displays files that would be copied.

/H

Copies hidden and system files also.

/R

Overwrites read-only files.

/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.

/K

Copies attributes. Normal xcopy will reset read-only attributes.

/Y

Overwrites existing files without prompting.

/-Y

Prompts you before overwriting existing files.

/N

Copy using the generated short names.

Examples

xcopy *.* /h hope

In the above example, the xcopy command will copy all files in the current directory
including any hidden files into the hope directory.

xcopy c:\temp /e

The above example is the basic xcopy command to copy the files, directories, and
subdirectories to the directory you're currently in.
xcopy "c:\documents and settings\hope" /e

In the above example the xcopy command would copy all files and directories in the user
"hope" directory to the directory or drive you're currently in.
xcopy hope example /e

In the above example this xcopy command copies all directories (even empty directories)
and files from the hope directory into the example directory.
xcopy h:\*.* /a /e /k

The above command would copy everything located on the H drive to the drive you are
currently on.

Questions and answers


Getting Invalid number of parameters error
This error occurs when you're typing a directory in the MS-DOS or the Windows command
line that has spaces in it. For example using the xcopy command to copy files in
the Documents and Settings folder. When typing a directory with spaces in MS-DOS make
sure to surround the path with quotes. For example, instead of typing: c:\documents and
settings type "c:\documents and settings".
Cannot perform a cyclic copy
This error occurs when you're trying to copy all directories and files and that directory also
contains the directory you're copying all the files to. If this command were to be allowed it
would get into a loop and would never stop copying the same files over and over. When
using the xcopy command if you're copying all subdirectories you must copy those files and
folders to a completely separate directory or drive.

Parse error
This error occurs when the command you're typing in has invalid syntax. For example, if
you're surrounding your path in quotes and leave out the ending quotes.
I attempted to use the above xcopy command and was not able to copy all files within
my favorites folder.
After further examination, Computer Hope also encountered this issue. However, was able
to copy the majority of all favorites by using the below command.
xcopy c:\windows\favorites\*.* /e /k /i /c
We are under the impression that this issue is generated because of the way that Internet
Explorer saves the URL (favorite) using long file names as well as extended characters.

Microsoft DOS robocopy command


About robocopy
A robust file copy command for the Windows command line.

Availability
The robocopy.exe command is an external command that is available in the below Microsoft
operating systems.

Syntax
ROBOCOPY source destination [file [file]...] [options]
source

Source Directory (drive:\path or \\server\share\path)

destination

Destination Dir (drive:\path or \\server\share\path)

file

File(s) to copy (names/wildcards: default is "*.*")

Copy options
/S

Copy Subdirectories, but not empty ones.

/E

Copy subdirectories, including Empty ones.

/LEV:n

Only copy the top n LEVels of the source directory tree.

/Z

Copy files in restartable mode.

/B

Copy files in Backup mode.

/ZB

Use restartable mode; if access denied use Backup mode.

/EFSRAW

Copy all encrypted files in EFS RAW mode.

/COPY:copyflag[s]

What to COPY for files (default is /COPY:DAT).


(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

/DCOPY:T

COPY Directory Timestamps.

/SEC

Copy files with SECurity (equivalent to /COPY:DATS).

/COPYALL

COPY ALL file info (equivalent to /COPY:DATSOU).

/NOCOPY

COPY NO file info (useful with /PURGE).

/SECFIX

FIX file SECurity on all files, even skipped files.

/TIMFIX

FIX file TIMes on all files, even skipped files.

/PURGE

Delete dest files/dirs that no longer exist in source.

/MIR

MIRror a directory tree (equivalent to /E plus /PURGE).

/MOV

MOVe files (delete from source after copying).

/MOVE

MOVE files AND dirs (delete from source after copying).

/A+:[RASHCNET]

Add the given Attributes to copied files.

/A-:[RASHCNET]

Remove the given Attributes from copied files.

/CREATE

CREATE directory tree and zero-length files only.

/FAT

Create destination files using 8.3 FAT file names only.

/256

Turn off very long path (> 256 characters) support.

/MON:n

MONitor source; run again when more than n changes seen.

/MOT:m

MOnitor source; run again in m minutes Time, if changed.

/RH:hhmmhhmm

Run Hours - times when new copies may be started.

/PF

Check run hours on a Per File (not per pass) basis.

/IPG:n

Inter-Packet Gap (ms), to free bandwidth on slow lines.

/SL

Copy symbolic links versus the target.

/MT[:n]

Do multi-threaded copies with n threads (default 8).


n must be at least 1 and not greater than 128.
This option is incompatible with the /IPG and /EFSRAW
options.
Redirect output using /LOG option for better performance.

File Selection Options


/A

Copy only files with the Archive attribute set.

/M

Copy only files with the Archive attribute and reset it.

/IA:[RASHCNETO]

Include only files with any of the given Attributes set.

/XA:[RASHCNETO]

eXclude files with any of the given Attributes set.

/XF file [file]...

eXclude Files matching given names/paths/wildcards.

/XD dirs [dirs]...

eXclude Directories matching given names/paths.

/XC

eXclude Changed files.

/XN

eXclude Newer files.

/XO

eXclude Older files.

/XX

eXclude eXtra files and directories.

/XL

eXclude Lonely files and directories.

/IS

Include Same files.

/IT

Include Tweaked files.

/MAX:n

MAXimum file size - exclude files bigger than n bytes.

/MIN:n

MINimum file size - exclude files smaller than n bytes.

/MAXAGE:n

MAXimum file AGE - exclude files older than n days/date.

/MINAGE:n

MINimum file AGE - exclude files newer than n days/date.

/MAXLAD:n

MAXimum Last Access Date - exclude files unused since n.

/MINLAD:n

MINimum Last Access Date - exclude files used since n.


(If n < 1900 then n = n days, else n = YYYYMMDD date).

/XJ

eXclude Junction points. (normally included by default).

/FFT

Assume FAT File Times (2-second granularity).

/DST

Compensate for one-hour DST time differences.

/XJD

eXclude Junction points for Directories.

/XJF

eXclude Junction points for Files.

Retry Options
/R:n

Number of Retries on failed copies: default 1 million.

/W:n

Wait time between retries: default is 30 seconds.

/REG

Save /R:n and /W:n in the Registry as default settings.

/TBD

Wait for sharenames To Be Defined (retry error 67).

Logging Options
/L

List only - don't copy, timestamp or delete any files.

/X

Report all eXtra files, not just those selected.

/V

Produce Verbose output, showing skipped files.

/TS

Include source file Time Stamps in the output.

/FP

Include Full Pathname of files in the output.

/BYTES

Print sizes as bytes.

/NS

No Size - don't log file sizes.

/NC

No Class - don't log file classes.

/NFL

No File List - don't log file names.

/NDL

No Directory List - don't log directory names.

/NP

No Progress - don't display percentage copied.

/ETA

Show Estimated Time of Arrival of copied files.

/LOG:file

Output status to LOG file (overwrite existing log).

/LOG+:file

Output status to LOG file (append to existing log).

/UNILOG:file

Output status to LOG file as UNICODE (overwrite existing log).

/UNILOG+:file

Output status to LOG file as UNICODE (append to existing log).

/TEE

Output to console window, as well as the log file.

/NJH

No Job Header.

/NJS

No Job Summary.

/UNICODE

Output status as UNICODE.

Job Options
/JOB:jobname

Take parameters from the named JOB file.

/SAVE:jobname

SAVE parameters to the named job file.

/QUIT

QUIT after processing command line (to view parameters).

/NOSD

NO Source Directory is specified.

/NODD

NO Destination Directory is specified.

/IF

Include the following Files.

Examples

robocopy c:\hope c:\hope2 *.txt

In this first example any .txt file would be copied from the hope directory into the hope2
directory. Whenever you want to copy one or more files and not a complete directory the file
must be specified after the destination directory.
robocopy c:\hope c:\hope2

In the above example the robocopy command would copy all files (not directories) in the
hope directory to the hope2 directory.

robocopy c:\hope c:\hope2 /e

In the above example all files and folders (including empty ones) will be copied from the
hope directory to the hope2 directory.
robocopy c:\hope c:\hope2 /MIR

This example will mirror what is in c:\hope into c:\hope2 and purge any files in the hope2
directory that do not exist in the hope directory. Use the /mir switch cautiously since it will
be deleting files that do not match in the destination directory.
robocopy \\computer\hope C:\hope2

Next, this example would copy any of the files in the hope directory on the network
computer named computer to the current computer hope2 directory.

Microsoft DOS edit command


About edit
The MS-DOS Editor is a command line text editor that allows you to view, create, or
modify any file on your computer. When running the edit command a screen similar
to the picture below is shown.

Availability
The edit command is an external command that is available in the below Microsoft
operating systems.
MS-DOS 5.x and above
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista*
Windows 7*
* 64-bit versions of Windows do not support the edit command use notepad to edit files.
Notepad can be started from the Windows command line by using the start command.

Syntax
EDIT [/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]
/B

Forces 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.

/<nnn>

Load binary file(s), wrapping lines to <nnn> characters wide.

/?

Displays this help screen.

[file]

Specifies initial files(s) to load. Wildcards and multiple file specs can be
given.

Examples

edit c:\autoexec.bat

This would look at the autoexec.bat. However, if the file is not found a blank blue screen is
shown. When editing this or any file, ensure that you know what you are placing in the files
improperly editing the file can cause issues with your computer.
If you are unable to get this program to work, try typing in "path c:\windows\command" if
you haveWindows 95 or higher, or type in "path c:\dos" if you have Dos 5.x/6.x/7.x
or Windows 3.x and try again. If you still are not able to get edit to work, it may not be on
the hard drive; Type in dir edit.com /s at the c:\>. If it says that the file is not found, you
may not have this feature.
If you are running an MS-DOS version 4.x or lower or you are unable to find edit.com on
your hard drive, you can also use the below command to create a file.
copy con <name of file>

Once you have entered the above command this will create the file with the name specified.
Once you have typed all the lines you want to be in the file, press and hold CTRL + Z. This
should enter ^Z, once on the screen, press enter and one file should be copied.

Using edit to create a file


Using edit you can also create files; for example, if you wanted to create a file called
myfile.txt, you would type the below command.

edit myfile.txt

This would bring up a blank edit screen, as long as the file is saved upon exit this will
create the file myfile.txt.

Additional information
Note: Edit is only able to open a file with a maximum of 65,280 lines.
If your mouse drivers are not loaded while in MS-DOS or the Windows command line you
may have no mouse support. It is still possible to navigate the Editor using shortcut keys
as seen in the below list.
Quick Tip: Pressing Alt allows you to quickly navigate through edit without having to
memorize the below commands.
Home

Move cursor to the beginning of the line currently on.

End

Move cursor to the end of the line currently on.

Ctrl + Up

Scroll up one line.

Ctrl + Down

Scroll down one line.

PageUp

Scroll up one screen.

PageDown

Scroll down one screen.

Ctrl + PageUp

Scroll left one screen.

Ctrl + PageDown

Scroll right one screen.

Ctrl + Home

Scroll to the top of the document.

Ctrl + End

Scroll to the bottom of the document.

Ctrl + Left

Move left one word.

Ctrl + Right

Move right one word.

Enter

Starts a new line or moves text after cursor down.

Delete (Del)

Deletes one character that cursor is on or currently selected text.

Backspace

Deletes one character before the cursor.

Tab

Moves cursor or text to next tab stop, or indents line if at first


character.

Insert

Switch between insert and overwrite modes.

Ctrl + Y

Deletes the current line.

Ctrl + V

Pastes contents currently within buffer, if any.

Ctrl + P

Allows special characters to be inserted into Edit.

Shift

Using shift in combination with any of the above scrolling or


moving commands will highlight text, such as Ctrl + Shift +
Right.

Ctrl + C

Copies currently selected text into buffer.

Ctrl + X

Cuts the currently selected text into buffer.

Shift + Tab

Removes indents on the selected line.

Ctrl + Q + F

Find text.

Ctrl + Q + A

Find and replace text.

F3

Repeat last search.

F6

Switch to the next edit window, if any.

Ctrl + F6

Open new edit window.

Ctrl + F4

Closes second edit window.

Ctrl + F8

Resizes edit window.

F1

Displays help.

Microsoft DOS del command


About del
Del is a command used to delete files from the computer.

Availability
The del command is an internal command and is available in the below Microsoft operating
systems.
The delete command is a recovery console command and is available in the below Microsoft
operating systems.
Windows 2000
Windows XP

Syntax
Windows XP, Windows 2000, and later syntax
Windows 2000 and Windows XP recovery console syntax
Windows 95, 98, and ME syntax
Windows XP, Windows 2000, and later syntax
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names


ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
names

Specifies a list of one or more files or directories. Wildcards may be used to


delete multiple files. If a directory is specified, all files within the directory
will be deleted.

/P

Prompts for confirmation before deleting each file.

/F

Force deleting of read-only files.

/S

Delete specified files from all subdirectories.

/Q

Quiet mode, do not ask if ok to delete on global wildcard

/A

Selects files to delete based on attributes

attributes

R Read-only files S System files H Hidden files A Files ready for archiving Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:


The display semantics of the /S switch are reversed in that it shows you only the files that
are deleted, not the ones it could not find.

Windows 2000 and Windows XP recovery console syntax


Deletes one file.
del [drive:][path]filename
delete [drive:][path]filename
[drive:][path]filenameSpecifies the file to delete.
Delete only operates within the system directories of the current Windows installation,
removable media, the root directory of any hard disk partition, or the local installation
sources.
Del and delete do not support replaceable parameters (wild cards).

Windows 95, 98, and ME syntax


Deletes one or more files.

DEL [drive:][path]filename [/P]


ERASE [drive:][path]filename [/P]
[drive:][path]filename

Specifies the file(s) to delete. Specify multiple files by using


wildcards.

/P

Prompts for confirmation before deleting each file.

Examples

Note: In Microsoft Windows deleted items go to the Recycle Bin, keep in mind that deleting
files from MS-DOS or the Windows command line does not send files to the Recycle Bin.
Tip: Use the rmdir or deltree command to delete directories
del test.tmp

Deletes the test.tmp in the current directory, if the file exists.


del c:\windows\test.tmp

Delete the c:\windows\test.tmp in the windows directory if it exists.


del c:\windows\temp\*.*

The * (asterisks) is a wild character, *.* indicates that you would like to delete all files in the
c:\windows\temp directory.
del c:\windows\temp\?est.tmp

The ? (question mark) is a single wild character for one letter, which means this command
would delete any file ending with est.tmp such as pest.tmp or zest.tmp.

Microsoft DOS attrib command


About attrib
Attrib allows a user to change the attributes of a file or files. With attrib, you can change
any of the add or remove any of the attributes below. Note: if you need to change the ACL of
a file see the CACLS command.
Read-only - allows the file to be only viewed and not written to or changed.
Archived - allows Microsoft Backup and other backup programs to know what files to back
up.
Hidden - makes files invisible to standard users and hidden if show hidden files is enabled.
System - makes the file an important system file.
Note: With new versions of Windows (e.g. Windows 7 and 8) there are additional attrib
options not mentioned in the above list. See the Syntax for your version of Windows to get
all available options.

Availability
The attrib.exe command is an external command that is available in the below Microsoft
operating systems.
MS-DOS 3.0 and above
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7
Windows 8

Syntax
Windows 7 and Windows 8 syntax
Microsoft Windows 2000 and Windows XP syntax
Microsoft Windows 2000 and Windows XP recovery console syntax
Microsoft Windows 95, 98, and ME syntax
Windows 7 and Windows 8 syntax
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]]
+

Sets an attribute.

Clears an attribute.

Read-only file attribute.

Archive file attribute.

System file attribute.

Hidden file attribute.

Not content indexed file attribute.

No scrub file attribute

Integrity attribute.

/S

Processes matching files in the current folder and all subfolders.

/D

Process folders as well.

/L

Work on the attributes of the Symbolic Link versus the target of the
Symbolic Link

See our attrib examples for information and examples on how to use this command.
Microsoft Windows 2000 and Windows XP syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename] [/S [/D]]
+

Sets an attribute.

Clears an attribute.

Read-only file attribute.

Archive file attribute.

System file attribute.

Hidden file attribute.

/S

Processes files in all directories in the specified


path.

/D

Process folders as well.

See our attrib examples for information and examples on how to use this command.
Microsoft Windows 2000 and Windows XP recovery console syntax
Note: The below options are the available options in the Windows recovery console.
Changes attributes on one file or directory.
ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename
+

Sets an attribute.

Clears an attribute.

Read-only file attribute.

System file attribute.

Hidden file attribute.

Compressed file attribute.

See our attrib examples for information and examples on how to use this command.

Microsoft Windows 95, 98, and ME syntax


Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S]
+

Sets an attribute.

Clears an attribute.

Read-only file attribute.

Archive file attribute.

System file attribute.

Hidden file attribute.

/S

Processes files in all directories in the specified


path.

Examples
attrib

Typing attrib by itself displays all files in the current directory and each of their attributes.
If any file is hidden it also displays those files.

As can be seen in the above example we typed the dir command to list the files in the
current directory and could only see the "computer.bat" file listed. However, when we type
attrib by itself, we can see that there are three files in this directory, "computer.bat" with
read-only, "example.txt" with hidden, and "hope.txt" with the hidden and read-only
attribute.
attrib +r autoexec.bat

Add the read-only attribute to the autoexec.bat file so it cannot be modified until the readonly attribute is taken off. This is helpful for important system files or any other file that
you do not want to have mistakenly edited or changed by another program.
attrib +h config.sys

Add the hidden attribute to the config.sys file causing it to be not be seen by the average
user.
attrib -h config.sys

This command does the opposite of the example shown before this command. Instead of
hiding the file this command makes the file visible if hidden.
attrib +r +h autoexec.bat

Finally, this example adds two attributes to the autoexec.bat and makes the file read-only
as well as hidden.
How can I see hidden files in MS-DOS?
Extended information
Most users never need to deal with a files bit position or hex value. However, for those
needing this information when working with MS-DOS and the Windows command line
below are the file attributes bit positions and HexValues with bit positions in the order of "7
6 5 4 3 2 1 0."
Bit Positions

Hex

0000000
1

01h

Read-only file

0000001
0

02h

Hidden file

0000010
0

04h

System file

0000100
0

08h

Volume Label

0001000
0

10h

Subdirectory

0010000
0

20h

Archive

0100000
0

40h

Reserved

1000000
0

80h

Reserved

Examples

Description

0010000
1

21h

Read-only, Archive

0011001
0

32h

Hidden, Subdirectory, Archive

0010011
1

27h

Read-only, Hidden, System file,


Archive

0010001
1

23h

Read-only, Hidden, Archive

Additional information

Vous aimerez peut-être aussi