Windows – How to Recursively Delete Directory from Command Line

cmd.execommand linewindows

What is the windows equivalent of rm -r [directory-name]?

Best Answer

deltree if I remember my DOS.


It seems it's been updated... this is what you want:

RMDIR /S

This removes the directory C:\test, with prompts :

rmdir c:\test /s

This does the same, without prompts :

rmdir c:\test /s /q

Regarding the sudo part of your question, if you need more priviliges, you can first open a new shell as another user account using the runas command, like this:

runas /user:Administrator cmd
rmdir c:\test /s /q
Related Question