[–] toobaditworks [S] 0 points 0 points (+0|-0) ago  (edited ago)

Another example is you can use SET command to set the directory then use this to delete the files in the folder you choose. Remove the rmdir line if you DON'T wish to delete the entire directory afterwords. And be careful with this.

set "myDir=C:\test\"

takeown /f %myDir% /r

forfiles /P %myDir% /C "cmd /c if @isdir==TRUE rmdir /S /Q @file"

del /q /f %myDir%.

rmdir /s /q %myDir%

cmd /k