You have probably run into this problem countless times. You want to delete, move, or write to a file but you receive a “File in use” or “process cannot access file” error message. With the free EMCO UnLock IT tool, you can analyze the problem and then unlock the file or an entire folder.
Latest posts by Michael Pietroforte (see all)

If you try to delete a file that another process is using, you will receive this error message: File in use – The action can’t be completed because the file is open in…

File in use - The action can’t be completed because the file is open in

File in use - The action can’t be completed because the file is open in…

Various reasons exist why a Windows process locks a file to prevent other programs from tampering with it. Thus, whenever you encounter the “file in use” message, you had better leave the file alone and ensure that the corresponding application finishes its job. However, programs do not always do what they were intended to do, and in those cases a locked file can cause problems.

Restarting the application or Windows usually solves the problem, but this is often an inconvenient solution. You then need a tool that allows you to unlock the file. UnLock IT has been around for quite a while. The new version 4.0, released a few days ago, has all the features you need to unlock files.

Analyzing locked files ^

What I like about the tool is that it integrates itself in File Explorer. So, if you are unable to delete or move a locked file, you can just right-click it and unlock or delete it right away from the context menu.

Unlock IT in File Explorer

UnLock IT in File Explorer

Note that this procedure requires administrator privileges, which is why you will be confronted with a UAC prompt.

If you are dealing with a sensitive file, you might prefer to first check what process locked the file. This will open UnLock IT’s user interface, where you will get all the information you need. You will see what program locked the file and where it is located. In addition, you can get detailed information about the corresponding process if you right-click the executable and navigate to Properties.

EMCO Unlock IT - The new user interface

EMCO UnLock IT - The new user interface

On the General tab, you will see common information, such as the application maker or the Windows user that owns the program file. The Performance tab is new and offers very detailed information about the process, such as CPU load, handles, and memory usage.

Unlock IT - Performance properties

UnLock IT - Performance properties

Also new are the File Handles and Library Handles tabs, which give you an overview of the other files that the process uses.

UnLock IT allows you to check folders for locked files. The tool will then list all programs that have locked the folder or some of the files it contains. On the File Handles tab, you can then find those locked files.

A problem is here that the tab also lists all files that the process opened in other folders. This information can be useful if you have to determine the purpose of the program. However, it also makes it hard to sort out the files that are locked in the folder. It would be helpful if UnLock IT had another tab that only lists locked files in the folder. I would also like to have a column in the main interface that lists all locked files in the folder and sub folders.

Unlocking files ^

You then have essentially two options to deal with the problem through the context menu of the program that locked the file. The safest way is to close the corresponding file and/or DLL handle. Of course, this can still cause problems if the application has some unfinished business with the file.

If this doesn’t work, you can just kill the process. The latter option is sometimes required if the process hangs. Of course, the impact on your system is much bigger than just closing the handle because it affects all other files that the application to which the process belongs has opened.

If you want to unlock an entire folder, you can select all processes that UnLock IT found and then execute one of the above commands through the context menu. This is certainly the riskiest thing you can do if many different processes are involved. Thus, you had better know the purpose of the corresponding programs.

If you want to test UnLock IT, you can lock a file with the following PowerShell command:

$File = [System.io.File]::Open('C:\tmp\test.txt', 'Open', 'Read', 'None')

The fourth parameter of the .NET function, which opens the file, controls sharing and is set to “None.” If you then try to open the text file with Notepad, you will receive this error message: The process cannot access the file because it is used by another process. You will get a corresponding error message if you try to delete or move the file.

You can then either right-click the test file in File Explorer and navigate to UnLock IT’s context menu or check the file through UnLock IT’s user interface.

Aside from the above-mentioned performance and handles tabs, UnLock IT 4.0 comes with a revamped user interface that resembles all of EMCO’s highly customizable IT tools. Also new is the Operation Management view that displays all ongoing actions that UnLock IT currently performs. If you have to unlock a large number of files, you can observe the currently running tasks here. The application log where UnLock IT records all actions can also be exported to a CSV file. The tool now officially supports Windows 10.

You can download the free EMCO UnLock IT tool here, and this page lists the new features in version 4.0.

2 Comments
  1. Mike 6 years ago

    Dealing with this issue is something I was just faced with. I just finished up a set of powershell scripts that integrate our AD with our school district student information systems, when a new student enters, an existing one changes or a student leaves, I make the same change be reflected in our AD (and GAFE if necessary).

    I have CSV files that the student info such as name, username, password, building populated and stored on a read only share available to teachers. My concern is that when my scheduled task runs hourly against data gathered from the SIS and my changes are made, I will eventually run into a situation where a teacher has the credentials document open and it is locked when my scripts try to manipulate the data.

    Is there a way I can integrate the EMCO UnLock IT tool (or maybe even a native Windows method) into my scripts so that it will check to see if the file is in a writable state, and if not, force close the file so my data can be written?

    I love getting your blog emails, it is usually very valid and helpful info!

    Mike

  2. Mike, the tool also has a command line interface. However, I didn't try it with PowerShell.

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2021

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account