This post is one more about system maintenance, and more specifically, how to remove files that have their permissions locked. My assumption is that many of you, like me, will install a variety of applications to test if they will be of benefit to you. As a designer, this is especially necessary, but I periodically come a cross an application or script that won’t allow me to move, rename, or delete it. This is irksome, and always makes me wonder why it is locked in such a way (a common trait of trojans and viruses), so I recognize the need to remove it permanently. Note that if the file is a virus/trojan, the following may not work, in this case you will likely need to quarantine it using your virus scan program.
Ok, so with any file, the first thing to do is look at the permissions. Right mouse-click on it, and at the bottom of the pop-up menu is “properties”. Click on properties, and then look at “security”. You will see who is allowed to delete the file, be it the system, the user, or the administrator/s. By selecting “edit” you should be able to provide yourself full control of the file/application by selecting the appropriate permissions box and selecting “apply”. Once the permissions have changed see if you can delete it. In some case though you simply need to exit the folder, and then open up another folder and click and open an item in it, and then navigate back to the folder you want to delete. This in effect will clear the cache associated with having opened the folder/file you wished to delete previously. And a restart of the computer will often clear all programs that have been associated with the folder/file, which will allow it to be deleted.
If only things were this easy, yet from my experience, this doesn’t always work. When you attempt to delete the file or application, you will still receive a message that it can’t be deleted because it is open by another user, … is being used by the system, … or being used by another application. All these are basically saying the same thing, the file has been locked by something that you don’t have the ability to access, change, or control.
The next step is to install a registry file which can be found online that allows you to “Take Permission”. You can find this here: https://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/ This may work for you, but again, I have found that in many cases this won’t work. So what’s next you ask?
In this case you need to delete the file from MS-Dos. Note that windows has a MS-Dos prompt that can be accessed through regular windows by typing in “CMD” in the run bar/box from the start menu, and by going to “programs” / “accessories” / “command prompt”. The problem here is that if the file has been locked by the system, then you will still receive the same error you had before, so you won’t be able to modify it, be it renaming or deletion.
This leaves us with the only real option. You need to restart your computer, and before the window screen loads click “F8”; this will start the computer in “Safe Mode”. Select the option to start with the command prompt. The screen loads and you will see the large MS-Dos screen. Next you will need to navigate to where your file is located. I typically have my files placed in my downloads folder when testing, so this is where I will navigate to. What you do is type:
- cd C:
You will see the directory change to C: - I then type in dir/w
dir/w shows you the directory tree view - I type is cd Users
cd simply means change directory, you will see: C:Users> - I type in dir/w
Here I will see my name since I am the only user - cd Edmund
I see: c:UsersEdmund> - I type in dir/w
Now I will see all the files and folders in this directory under my user account. Since all my files are in folders, I will see each name as follows: [Downloads] [Music] [Pictures] … etc. Note that the square brackets indicate that it is a folder, not just a file. - Now I type in cd Downloads, and I see: C:UsersEdmundDownloads>
- I type in dir/w again and I will see all the files and folders in my Download directory. At this point I simply type in: del filetodelete.exe (replace “filetodelete.exe” with your file name and file extension).
The important thing here is to remember to add the extension since you won’t see it in MS-Dos view. If your file has a space in the name, something like “fileto – delete.exe” you will need to account for the spaces since Ms-Dos doesn’t recognize spaces in names. In this case type in “fileto?-?delete.exe”. As you can see I replaced the space with a question mark (?). If you need to delete an entire folder, type deltree foldername. If you have questions on any command, such as this last one, type deltree /? . The /? after a command will provide a help-file on it.
Once the file/s are deleted, restart your computer as normal.