The Command prompt is one of the most basic element of Windows. When everything else fails, it is the command prompt which will ultimately come to your help. One of these things where the command prompt might be your ultimate hope, is when your computer gets infected and once you’ve cleaned it, no matter how long you try, there remain many files and folders that would simply refuse to be deleted.
In a situation like this, it becomes extremely important to delete these files as there will be a chance of the infection recurring. So how would you delete such files on windows which cannot be deleted with the windows explorer.
Well, you can make use of an free tool for windows called Unlocker and it will help you to delete any undeletable files and folders from windows with ease.
Alternatively you can even use the command prompt on windows to delete files which are refusing to be deleted via the windows explorer. However before we proceed ahead, i would only advise you to use this method if you are familiar with the command prompt. If the instructions are not followed properly, you might accidentally delete something else.
Here’s how you can use the command prompt on windows to forcefully delete files and folders.
How to Delete a single file using the Command Prompt on Windows
- Step 1: Run the Command prompt on windows.
- Step 2: You will need to type the following into the command line and press enter.
DEL /F /Q /A <File Path>
Here the /F parameter stands or force deletion of files, /Q parameter ensures the Forces deletion of read-only files, /A parameter will select only the files with the ready for archiving attribute, Finally you can replace <File path> with the path of the file or folder.
For example: Type in the following into the command prompt and press enter.
DEL /F /Q /A C:\Users\Lovejeet\Desktop\infected.txt
If the file gets deleted successfully, then you won’t receive any error.
How to Delete a Folder using the Command Prompt on Windows
- Step 1: Run the Command prompt on windows.
- Step 2: You will need to type the following into the command line.
RD /S /Q <Path of the Folder>
Here RD stands for Remove Directory, /S deletes all subfolder and files, /Q Deletes directories without confirmation.
For example: Type in the following into the command line and press enter.
RD /S /Q C:\Users\Lovejeet\Desktop\Folder
If the folder gets deleted successfully, then you won’t receive any error.
i get an access denied error for every file/folder in that directory.
i have opened the command prompt with admin privileges
Try starting the command prompt as an admin
use task manager to closer explorer.exe then restart it when you’re done
This doesn’t get around the infamous “access denied” error you get sometimes when deleting a folder in windows.
Try running the command prompt with admin settings.
Not working the second option.
Second option need to give the details within” “.
rd/s/q e:xyzdosomething
the same format use to delete your folder just replace xyz to your folder name and dosothing with your inner folder what you have to delete
and it works.
example- rd/s/q e:mscodenodeapp
DO NOT USE UPPER CASE as he has directed
thanks man
tried delete, first delete from cmd, then it was still showing there, then I delete from Windows it did. done. these chinese virus gave me headache.
it says; it used by another process, how to end that process to succesfully delete that file?? first of all how to find that which process uses this file??
MyFolder> RD /S /Q library
Access is denied.
MyFolder>rd/s/s library
library, Are you sure (Y/N)? Y
Access is denied.
How can i do force delete?
Open cmd as Run Administrator
does it compe letly remove from pc? cause i didnt see the folder in the garbge.
Second option not work for me… I already run it as an admin, but still Access Denied