rd rmdir 命令文档

rd

删除一个目录,这个命令和rmdir是一样的。

 

格式

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

参数

参数描述
[<Drive>:]要删除的目录路径
/s删除目录树。 (目录及其子目录,包括所有的文件)
/q安静模式 。删除一个目录树的时候不询问确认。 (注意 /q 仅在同时使用 /s 时有效)
/?显示帮助信息。

 

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. After the hidden and file attributes have been removed, you can delete the files.

  • 在Path的开始处使用反斜杠字符,路径将会从根目录开始(不管当前目录是什么)

  • 不能使用rd删除当前目录。如果你尝试删除当前目录,将会出现以下错误信息:

    The process cannot access the file because it is being used by another process.

    If you receive this error message, you must change to a different directory (not a subdirectory of the current directory), and then use rd (specify Path if necessary).

  • 在恢复控制台可以使用rd命令。

 

Examples

不能删除当前目录。必须先切换到当前目录之外才可以。例如可以切换到父目录:

cd ..

现在你可以删除你想要删除的目录。

使用/s选项删除一个目录树. 例如,删除一个名为test的目录(以及它的子目录和文件) from the current directory, type:

rd /s test

对于上面的例子使用安静模式运行:

rd /s /q test

 

注意

如果使用在安静模式下运行rd /s整个目录树会在没有询问确认的情况下删除。请保证在使用/q选项前将重要的文件已经移动或备份。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值