You can create and delete Windows folders from Command Prompt using mkdir and rmdir.

Why create and delete folders using the Command Prompt?

These commands are useful when working in a terminal or repeating folder-management tasks. Use them only in locations where your Windows account has the required permissions.

Open Command Prompt

Press Windows + R, enter cmd and press Enter. Administrator access is only needed if the target location requires it.

Check your current directory before using a relative path. To work in your own Documents folder, run:

cd /d "%USERPROFILE%\Documents"

If this folder has been redirected or does not exist, use the actual path shown in File Explorer instead.

How to create a folder using CMD

Create a folder in the current directory:

mkdir Projects

Enclose names or paths containing spaces in straight double quotation marks:

mkdir "New Folder"

Check the contents of the current directory:

dir

How to delete a folder using CMD

Deletion with rmdir does not send folders to the Recycle Bin. Check the target path and keep a backup of anything you need before continuing.

Remove an empty folder:

rmdir "New Folder"

To remove a folder and everything inside it, use /s:

rmdir /s Projects

Read the confirmation prompt before answering. The /q option suppresses this confirmation, so leave it out when deleting folders interactively.

Common examples

Use a full path to create a nested folder. This example creates Reports below Projects in your Documents folder:

mkdir "%USERPROFILE%\Documents\Projects\Reports"

To delete that folder, first check its contents and then remove it:

dir "%USERPROFILE%\Documents\Projects\Reports"
rmdir /s "%USERPROFILE%\Documents\Projects\Reports"

Replace the example path with the intended target. Do not run a deletion example unless you want to remove that folder and its contents.

Tips and best practices

  • Use full paths when the current directory is uncertain.
  • Keep paths containing spaces inside straight double quotation marks.
  • Move out of a directory before trying to delete it; rmdir cannot remove your current directory.
  • Close applications using files in the folder if deletion fails.
  • Check permissions rather than automatically running every command as an administrator.