rd

Удаляет каталог.

The rd command can also run from the Windows Recovery Console, using different parameters. Дополнительные сведения см. в разделе "Среда восстановления Windows" (WinRE).

Note

This command is the same as the rmdir command.

Syntax

rd [<drive>:]<path> [/s [/q]]

Parameters

Parameter Description
[<drive>:]<path> Указывает расположение и имя каталога, который требуется удалить. Path is required. If you include a backslash () at the beginning of the specified path, then the path starts at the root directory (regardless of the current directory).
/s Удаляет дерево каталогов (указанный каталог и все его подкаталоги, включая все файлы).
/q Задает тихий режим. Не запрашивает подтверждение при удалении дерева каталогов. The /q parameter works only if /s is also specified.

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

/? Отображает справку в командной строке.

Remarks

  • Невозможно удалить каталог, содержащий файлы, включая скрытые или системные файлы. При попытке сделать это появится следующее сообщение:

    The directory is not empty

    Use the dir /a command to list all files (including hidden and system files). Then use the attrib command with -h to remove hidden file attributes, -s to remove system file attributes, or -h -s to remove both hidden and system file attributes. После удаления скрытых и файлового атрибутов можно удалить файлы.

  • You can't use the rd command to delete the current directory. При попытке удалить текущий каталог появится следующее сообщение об ошибке:

    The process can't access the file because it is being used by another process.

    Если вы получаете это сообщение об ошибке, необходимо изменить другой каталог (а не подкаталог текущего каталога), а затем повторить попытку.

Examples

Чтобы изменить родительский каталог, чтобы можно было безопасно удалить нужный каталог, введите следующее:

cd ..

To remove a directory named test (and all its subdirectories and files) from the current directory, type:

rd /s test

Чтобы запустить предыдущий пример в тихом режиме, введите:

rd /s /q test