批處理指令碼 - 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

輸出

所有操作均按批處理檔案中的備註執行。

batch_script_commands.htm
廣告