Delete read-only file using batch file or command

I would like to know a way to delete a read-only file using a batch file or command.

Suppose I have a DLL file named "abc.dll" and I am trying to delete that file using the following command in a batch file:

del "C:\test\abcd.dll"

      

It prevents me from doing this and it throws an access denied message. However, if I change the read-only read-only attribute, I can successfully remove it.

+2


source to share


2 answers


Specify /F

this will delete read-only files. Also see

del /?

      



However, this will not work when the file is in use.

+12


source


del /f

will delete read-only files.



+3


source







All Articles