These are the methods required to deleted files that refuse to be deleted in a conventional way, it is also important if for some reason you can’t see hidden files in Windows Explorer and Windows system or when it refused a request to delete a file or folder and found error message.
How To Delete a file with CMD console, step by step method
- To start the first step is to open the cmd console window, press the Windows key on the keyboard, type CMD and press ENTER. You can also click the mouse on Start and type cmd.
- The second step is to close the Windows Explorer, it is important to so that no error message that the file can not be deleted because it is being used or open. To close the window explorer type or paste in the cmd window: “Taskkill / F / IM explorer.exe”. Don’t worry you can reopen it in Windows by typing : “START Explorer.exe” if you want to check.
- Access to the drive where the file will be deleted, type the drive letter followed by a colon and press ENTER, the cmd screen should show ” C: \> ” if it other drive just replaced by the appropriate letter.
- Open another cmd window, use the first that we open as “A” for the operation and that we will open as “B” to be used as a kind of monitor to see the results of operations that are affected. To open the “B” type: “START CMD / K “, press ENTER and drag it to the left of the screen.
- Now we will list the files on the drive where we are, in this example C, which displays all files, hidden or not, to do it type in: DIR and press ENTER. You can view the list and you can easily distinguish files from folders and view files you want to delete.
- Now we know the attributes of the file, but what is attributes?Windows assigns different attributes for each file in our PC, according to the function or purpose to be played and identified by a letter :
• A file attribute storage.
• R read-only attribute of the file.
• H Hidden file attribute.
• S System file attribute.
To find out the attributes of your files, type “A”, attrib filename as in two examples:
attrib start.exe attrib autorun.inf Windows will restore the existing attributes such as: ATTRIB start.exe R H C:\start.exe ATTRIB autorun.inf R H S C:\ autorun.inf
Now you know you can delete them to remove effectively, type:
Attrib-attribute filename, will be as follows:
ATTRIB -R -H start.exe ATTRIB -R -H -S autorun.inf
- If the operation is successful then you can delete it now, it would be simpler:
DEL file name, for example:
DEL start.exe DEL autorun.inf
To confirm that the file has been deleted refresh window “B”, to do this press the F5 key followed by ENTER.
Now go back to step 3, assuming the file you are looking for is not located in the root of the drive if it is not in a folder, for example, called “Applications” to put yourself in it type:”CD Application” and press ENTER, you will see the symbol on the screen now shows
C: \ Applications>
To return to the root of the drive used: “cd .. / ” and press ENTER
If everything successful to go back to Windows, as I described above using: “START Explorer.exe”
How to delete a folder with all its contents
Sometimes you may need to delete the folder or directory with the files contained in it, then the RD command is perfect.
RD – Removes a directory.
Simplest useful command to delete a folder that refuses to be deleted, which is made by the application with read-only attribute.
To delete a directory with everything inside just use:
RD / S dirname
If Windows Explorer is open, do the following :
• Open a CMD console
• Type: RD / S
• Press the Spacebar
• Drag a folder containing the file folder to be deleted via the console and drop.
• Press the Enter key.
In a manner similar to the above can be used to delete the contents of the folder:
DEL /S filename
Other commands you can use :
• If you need to close applications that use certain file you need to be able to close it using:
Taskkill / F / IM application name
• To find the exact name of the application uses:
and press ENTER
• To clean the screen using CLS.