Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
Showing results for 
Search instead for 
Did you mean: 

Powershell command equivalent to deltree /y ?

Go to solution
Daniel Simard
Frequent Advisor

Powershell command equivalent to deltree /y ?

Hi All,
I cannot find for the life of me a command equivalent to deltree /y we used to use back in the old days.


rd /s
etc... but it always states that it cannot delete a folder if it is not empty.

How do you delete (through command-line) a folder that is not empty in DOS on server 2008? or if you have a vbscript etc..
Si tu n'as pas ce que tu aimes, aimes ce que tu as.
Mayur Jain
Occasional Visitor

Re: Powershell command equivalent to deltree /y ?

Hi Daniel,
I tried the option
rd /s /q
rd c:\WINDOWS\Temp\Test /s /q
It worked perfectely fine on windows XP system. The "test" folder had empty folders and few files and it cleaned all.
Jon Finley
Honored Contributor

Re: Powershell command equivalent to deltree /y ?


DEL /F /S /Q foldername

Still works.

Power Shell

Get-Help Remove-Item -full

Remove-Item C:\Windows -recourse

Should delete all files and remove all sub-folders within the Windows folder.

"Do or do not. There is no try!" - Yoda