批處理Rd命令

批處理Rd命令用來刪除目錄,但需要目錄是空的,才可以被刪除。

語法

rd [directoryname]

示例

以下示例顯示了rd命令的不同變體(用法)。

@echo off
Rem removes the directory called newdir
rd C:\newdir
Rem removes 2 directories
rd Dir1 Dir2
Rem Removes directory with spaces
rd "Application A"
Rem Removes the directory Dir1 including all the files and subdirectories in it rd /s Dir1
Rem Removes the directory Dir1 including all the files and subdirectories in it but
asks for a user confirmation first.
rd /q /s Dir1

所有操作都按照批處理檔中的注釋執行。


上一篇: 批處理命令 下一篇: 批處理檔