David O Grady
David O Grady

Reputation: 25

How to delete a file that is giving the error "Access is denied" despite running powershell as administrator?

I was deleting the xampp directory off my computer and despite the uninstall completing fully, the xampp directory doesn't seem to be removed from the C:/ drive.

So I tried to delete it myself using the powershell terminal. I tried deleting the directory ("C:/xampp") and I got an "Access is denied" error so I tried doing the same thing but this time I tried running powershell as administrator but I still go the same error.

enter image description here

This is an image of the terminals response. There is an uninstall.exe file inside the xampp directory that I also can not delete despite running powershell as administrator.

Im new to posting on stack overflow so if I have doing something annoying or just plain wrong, let me know and I will edit the post.

Thanks for your time

Upvotes: 0

Views: 2297

Answers (1)

colsw
colsw

Reputation: 3326

try running rmdir .\xampp -force to fix the first error regarding a non-empty directory.

a lot of the time errors on one file (especially executables like your .exe) may be due to it currently running, so confirm that first, then make sure that you do have access to the file, local administrator may be explicitly denied access to the file or another group/account/etc. (e.g. trustedinstallers) may be the only one with access.

Upvotes: 1

Related Questions