Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: Folder - Delete from Command Prompt


Folder - Delete from Command Prompt

How to Delete a Folder in Windows from the Command Prompt
Published by Brink
16 Jan 2010
Published by

How to Delete a Folder in Windows from the Command Prompt


information   Information
This will show you how to permanently delete a Folder in Vista, Windows 7, or Windows 8 using the RD or RMDIR command from within a command prompt.

This can be handy if you cannot delete the folder using the normal methods.

Note   Note
While you can run this command in a non-elevated or elevated command prompt, you would get the best results using a elevated command prompt.

warning   Warning
The folder will be deleted immediately and not placed in the Recycle Bin first. Deleting a folder using this command will also delete all of it's contents as well as the folder. Be sure to backup anything you want to keep in the folder first.


EXAMPLE: RD and RMDIR Command
NOTE: You can use either the RD or RMDIR command in the command prompt. They are the same command.
Name:  About_RD_RMDIR.jpg
Views: 120497
Size:  88.7 KB


Here's How:
1. Do step 2 or 3 below for where you would like to use a command prompt at.


2. To Use a Elevated Command Prompt in Windows
A) Open an Elevated command prompt in Vista/Windows 7 or Windows 8, and go to step 4 below.
3. To Use a Command Prompt at Boot
A) Open a command prompt at boot in Vista/Windows 7 or Windows 8, and go to step 4 below.

B) In the command prompt, type diskpart and press Enter. (see screenshot below)

C) In the command prompt, type list volume and press Enter. (see screenshot below)
NOTE: This will let you see what the drive letter is for the drive that you want to delete the folder in since it may not always be the same drive letter that it is in Windows.

D) After making note of the drive letter, type exit and press Enter. (see screenshot below)
Folder - Delete from Command Prompt-command-1.jpg
4. In the command prompt, type the command below and press enter.
NOTE: Substitute Full Path of Folder within quotes below with your folder's full path within quotes instead.

Code:
RD /S /Q "Full Path of Folder"
NOTE: For example, if I wanted to delete a folder named Folder on my desktop, I would type this command below.

Code:
RD /S /Q "C:\Users\UserName\Desktop\Folder"
Name:  Elevated_Command_Prompt.jpg
Views: 110360
Size:  56.2 KB
5. The folder should now be deleted.

6. Close the command prompt.
NOTE: If you used a command prompt at boot, then also close the System Recovery Options window and restart the computer.
That's it,
Shawn




.

16 Jan 2010   #1
IggyAZ

Windows 7 Ultimate (32 bit)
 
 

Bringing back memories from 30 years ago.
I thought everyone know that.

DOS RULEZ!

My System SpecsSystem Spec
.

16 Jan 2010   #2
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Hello Iggy (John ),

Yeah, we've been having a few folks not being able to delete folders normally, so I thought this could help with that. DOS does rule.
My System SpecsSystem Spec
27 Feb 2010   #3
Razzputin

windows 7 ultimate was Vista home premium
 
 

Thank you worked like a charm
My System SpecsSystem Spec
27 Feb 2010   #4
karlsnooks

MS Windows 7 Ultimate SP1 64-bit
 
 

Guess it's too much to suggest to them:
rd /s /q %userprofile%\desktop\foldername
My System SpecsSystem Spec
27 Feb 2010   #5
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Hello Karl,

For only the C:\User\(user-name) location, that would be fine.

I just used the normal full path version since it would be a better example for all situations. Plus, the %path% may not work so well if a command prompt at boot is used. That's all.
My System SpecsSystem Spec
27 Feb 2010   #6
karlsnooks

MS Windows 7 Ultimate SP1 64-bit
 
 

Hello Shawn,
I agree.
Karl
My System SpecsSystem Spec
11 May 2010   #7
faridfaiz

windows 7 ultimate 64-bit
 
 
great

thanks dude.it work 100%
My System SpecsSystem Spec
11 May 2010   #8
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

You're most welcome Faridfaiz, and welcome to Seven Forums.
My System SpecsSystem Spec
12 May 2010   #9
baarod

Windows 7 Ultimate 64-bit
 
 

Quote   Quote: Originally Posted by Brink View Post
Hello Iggy (John ),

Yeah, we've been having a few folks not being able to delete folders normally, so I thought this could help with that. DOS does rule.
Arrgh! It's not DOS!!! If I try anything with Int 21h Windows 7 will not only reprimand me but ship me off to Jersey as well...
My System SpecsSystem Spec
Comment

 Folder - Delete from Command Prompt





Tutorial Tools



Similar help and support threads for2: Folder - Delete from Command Prompt
Windows 7 Tutorial Category
File - Delete from Command Prompt Tutorials
Solved double clicking a folder opens a command prompt General Discussion
command line to delete folder contents Performance & Maintenance
Run administrative command prompt from command prompt General Discussion
How do I Close an opened folder in Run or at the Command prompt General Discussion
Script or command to delete contents of Software Distribution folder? Windows Updates & Activation
File and Folder - Rename from Command Prompt Tutorials

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:41 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33