Saturday, February 13, 2010

Deleting undeletable files manually using command prompt

>Suppose the file we want to delete is named 'undeletable file' and is located somewhere in our c drive, program files. Our first step is to navigate to that folder using command prompt.


>To access the command prompt (for those who don't know, else skip to next procedure), press Win key + R to get the run command, or click on Start, then run and type 'cmd' or 'command' without the quotes. Vista users may use the Search box after clicking on Start.(click on the images to see them in their original size)
 
Once we get the command prompt, the next step is to go to the directory of the file we want to remove. In our case, we have a file in C:\Program Files\undeletable file.exe


>To navigate to that place we type the following without the quotes.

--type 'cd\' . This command takes us to the root (beginning) of the current drive (we are in C drive initially)

--type 'cd program files'. cd stands for change directory. We are using it because we need to go into a directory/ folder name 'program files'. After typing this, we will be inside program files and command prompt will show as follows. C:\Program Files>

>Now that we have come to our destination it is time to delete the file that we want to remove. To do this, you may additionally see if the file is present inside the current directory/folder. Do this by typing 'dir' and you can see your target file. This is not needed if you already know if the file is present inside that folder.

>Now, to delete the file type

del "undeletable file.exe" or

del undele~1.exe



The file name is put inside the double quotes because it has multiple words with space in between. If we neglect the quotes then it will detect only undeletable and will show error since there's no file with that name. Another method is to append ~1 after the 1st six letters of the file name. Note that in case of a file name such as 'bat manager.exe' the word bat has only 3 letters, so in such cases we write it as 'batman~1.exe' (without the quotes) and our work will be. What we are doing here is that we are neglecting the space character. See the image below to understand clearly.
 
>If all the procedures have been done properly then you will find that the undeletable file is now gone.


In most cases involving viruses, the files are locked into memory and are thus difficult to remove by the earlier method. Thus, if the above method has failed in removing your undeletable file then here is a method stronger than above.