-1

I'm playing around with hacking on my virtual machine and in that tried to delete a folder which Windows created by default - "Videos" or "Documents", etc.

I would like to delete that folder from the cmd (I tried as an admin) but it doesn't seem to work. When deleting it from the GUI there were no issues.

I tried the following:

rmdir /s /q folderpath

And always get: Access is denied

Oliver
  • 117
  • 2
  • 15

2 Answers2

1

start cmd in admin mode

takeown /F C:\{folder-name}\* /R /A 
icacls C:\{folder-name}\*.* /T /grant administrators:F 
rmdir /S /Q C:\{folder-name}\
raja emani
  • 151
  • 1
  • 4
0

From this StackOverflow answer:

RMDIR or RD if you are using the classic Command Prompt (cmd.exe):

rd /s /q "path"

If it tells you you have no access/permission to remove the directory, it's most likely an important Windows directory you shouldn't remove. You could try opening the CMD as Administrator, but be sure to check that it's safe to delete the folder.

Sinceris
  • 104
  • 5
  • I have tried opening it as an administrator, doesn't work either. I'm working in a virtual machine, so deleting anything important isn't the issue, I'm just playing around with cmd. The "Video" folder can be deleted when deleting it via GUI but not even with admin rights in cmd... – Oliver Oct 11 '21 at 10:15