Rd


Applies To: Windows Server 2008,Windows Vista

Deletes a directory. This command is the same as the rmdir command.

For examples of how to use this command, see Examples.

Syntax


Copy Code

rd [<Drive>:]<Path> [/s [/q]]
rmdir [<Drive>:]<Path> [/s [/q]]

Parameters

Parameter

Description

[<Drive>:]<Path>

Specifies the location and the name of the directory that you want to delete. Path is required.

/s

Deletes a directory tree (the specified directory and all its subdirectories, including all files).

/q

Specifies quiet mode. Does not prompt for confirmation when deleting a directory tree. (Note that /q works only if /s is specified.)

/?

Displays help at the command prompt.

Remarks

Examples

You cannot delete the directory that you are currently working in. You must change to a directory that is not within the current directory. For example, to change to the parent directory, type:


Copy Code

cd ..

You can now safely remove the desired directory.

Use the /s option to remove a directory tree. For example, to remove a directory named Test (and all its subdirectories and files) from the current directory, type:


Copy Code

rd /s test

To run the previous example in quiet mode, type:


Copy Code

rd /s /q test

Caution

When you run rd /s in quiet mode, the entire directory tree is deleted without confirmation. Ensure that important files are moved or backed up before using the /q command-line option.

Additional references

Command-Line Syntax Key