Delete Read only file from command line

by admin on June 29, 2010

We can’t delete a readonly file using straight ‘del’ command. We get access denied error in this scenario.

c:\>attrib readonlyfile.txt
A    R       C:\readonlyfile.txt
c:\>del readonlyfile.txt
c:\readonlyfile.txt
Access is denied.
c:\>


 We can use /A switch to delete such files with special attributes set. To delete read-only files we need to add /A:R to the del command.

Example:

c:\>del /A:R readonlyfile.txt

{ 1 comment… read it below or add one }

Techblogger June 29, 2010 at 3:05 pm

we can use /F switch too.. "del /F readonlyfile.txt" also works.

Reply

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: