I Keep Unlocking the File but It Gets Locked Again

Sometimes when you try to delete, rename or move a file in Windows, you may run across a message that the file is busy/locked/used by another process. Usually the proper name of the plan that keeps the file open is shown right in the File Explorer message window. To unlock the file, it is enough just to shut the program. However, it may occur that a file or a library is used by an unknown or system process. Then it is harder to unlock it.

Many apps open up files in the exclusive style. At the same time, the file is locked by a file organization preventing input-output operations from other apps and procedure. If you close the app, the file lock is released.

A file lock message may be different. For case, the following screenshot shows the file type and the app information technology is associated with:

File/Folder in Apply. The activeness tin't be completed because the file is open up in another program. Close the folder or file and try once again.

File in Use. The action can't be completed because the file is open in another program

Then you tin can easily understand which app has locked the file and close it.

However, sometimes y'all may see a more interesting message that a file is used past an unknown or Windows system procedure. Information technology may exist either a Windows process or other processes working with the System privileges, like an antivirus app, a backup amanuensis, an MSSQL database, etc.:

The action can't exist completed because the file is open in SYSTEM. Close the file and endeavour once more.

The action can't be completed because the file is open in SYSTEM

Let's try to find out what program, service or Windows system procedure is using a file, how to unlock the file and whether it may be released without endmost the parent process.

The easiest way to unlock the file is to end the procedure that has locked information technology. But it is not ever possible, peculiarly on the servers.

To notice a process that has locked a file, it is often recommended to employ the Unlocker tool. I don't apply Unlocker since it doesn't provide a detailed information about a process or a chain of processes having locked a file. Neither you lot tin unlock a file used by a process — yous accept to impale an app completely.

Also, it is a third-political party tool, and you should be very attentive when yous install it, because it suggests to install a whole bundle of programs you don't need.

When a procedure in Windows opens a file, a file descriptor (handle) is assigned to the input/output stream. The process and its kid processes access the file using the handler. Using Windows API, you tin send a signal to your file organization to free the file handle and unlock the file.

If you force file handles to close, it may effect in an unstable piece of work of your app or estimator. If you are not sure what may happen after you shut file handle of an app, do non do information technology on a production server unless you have tested information technology in advance.

How to Unlock a File Using Process Explorer?

ProcessExplorer is a free tool from the Sysinternals kit you can download from Microsoft website (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer). Let's try to observe a process that has locked a file and free the file by resetting the file handle of the process.

  1. You don't need to install ProcessExplorer: just download, extract and run procexp.exe as administrator;
  2. Select Discover -> Find Handle or DLL (or press Ctrl-F); process explorer - find handle or dll
  3. Specify the file name you want to unlock and click Search;
  4. Select the file you desire. The procedure having opened the file will be highlighted in the process tree. Right-click information technology and select Kill Process Tree to terminate the procedure. Withal, you can try and close the file handle without ending the process. The file handle you looked for is automatically highlighted in the Process Explorer lesser panel. Right-click the handle and select Close handle. Confirm closing the file; release a file handle using process explorer

If the lesser panel with the list of open process handles is non displayed in your Procedure Explorer, enable the option View -> Lower Pane View -> Handles.

So you have closed the file handle without catastrophe the parent process. Then you can remove or rename the file.

How to Release a File Handle Using the Handle Tool?

Handle is some other command line tool from the Sysinternals (you tin can download information technology on Microsoft website: https://docs.microsoft.com/en-the states/sysinternals/downloads/handle). It allows yous to find a process having locked your file and release the lock by freeing the handle.

  1. Download and excerpt the Handle annal;
  2. Open up the command prompt as an administrator and run the following control: handle64.exe > listproc.txt
  3. This control will relieve the list of open handles to a txt file. You can display handles for a directory the file you want to change is located in: Handle64.exe -a "C:\Program Files\App" or for the specific process: handle64.exe -p excel.exe
  4. Open listproc.txt in any text editor and notice the line that contains the name of the locked file. Copy the file handle ID (in the hex format). So go upwardly to the section where the process that owns the handle is shown and write down its ID. It is near likely that a process run as arrangement will have PID four. get open file handle id using handle64.exe

    For some Windows system processes, handle.exe returns the following message: wininit.exe pid: 732 \<unable to open process>. It means that you cannot get whatever information about these organization processes (even as administrator). To go file handles open by such processes, run the cmd.exe as System and try to get the list of handles again.

  5. And then get back to the command prompt and reset the file handle by its HandleID and ProcessID. The control has the post-obit format: handl64e.exe -c HandleID -p ProcessID For example: handl64e.exe -c 18C -p 18800 close file handle on windows 10
  6. The tool will prompt you to confirm closing of the file for the process. Ostend it past pressing y -> enter.

If the system reacts to the closing of the file correctly, you will unlock your file without ending the procedure or restarting your server/calculator.

hugginsbutoot.blogspot.com

Source: http://woshub.com/unlock-file-locked-windows-system-process/

0 Response to "I Keep Unlocking the File but It Gets Locked Again"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel