- Batch Script Tutorial
- Batch Script - Home
- Batch Script - Overview
- Batch Script - Environment
- Batch Script - Commands
- Batch Script - Files
- Batch Script - Syntax
- Batch Script - Variables
- Batch Script - Comments
- Batch Script - Strings
- Batch Script - Arrays
- Batch Script - Decision Making
- Batch Script - Operators
- Batch Script - DATE & TIME
- Batch Script - Input / Output
- Batch Script - Return Code
- Batch Script - Functions
- Batch Script - Process
- Batch Script - Aliases
- Batch Script - Devices
- Batch Script - Registry
- Batch Script - Network
- Batch Script - Printing
- Batch Script - Debugging
- Batch Script - Logging
- Batch Script Resources
- Batch Script - Quick Guide
- Batch Script - Useful Resources
- Batch Script - Discussion
Batch Script - RD
This batch command removes directories, but the directories need to be empty before they can be removed.
Syntax
rd [directoryname]
Example
The following example shows the different variants of the rd command.
@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
Output
All actions are performed as per the remarks in the batch file.
batch_script_commands.htm
Advertisements