How To Fix “The Process Cannot Access The File” Error In Windows

How To Fix The Process Cannot Access The File Error In WindowsHow To Fix The Process Cannot Access The File Error In Windows

Sometimes, a single file can be used by multiple applications and other processes. At other times, not so much. This is when you are likely to encounter the error message “The process cannot access the file [File Path] because it is being used by another process.”

The error statement suggests that the issue occurred because the file is busy and currently in use by another process. It makes sense and can easily be fixed by retrying the task when the file is free from its initial use. However, that is not always the case.

This error can also occur because of other reasons. Moreover, multiple instances have been reported when the aforementioned error occurs. For example, a user reported that the “The process cannot access the file” error occurred while trying to run a piece of code. In other instances, it was found that this error also occurs while using BitTorrent and uTorrent applications.

Regardless of where this issue occurred, under whichever circumstances, the solutions given below to mitigate the problem should surely work for you.

What Causes “The Process Cannot Access The File” Error

As we mentioned earlier there is not just one reason for the error to occur. Apart from the fact that the file may actually be busy elsewhere, other factors can cause the said error.

  • Administrative privileges may be required

    If you encountered the error while trying to run a command inside a Command Line Interface (CLI) or an Integrated Development Environment (IDE), it may be possible that you do not have the required privileges to access the file. This would result in the “The process cannot access the file [File Path] because it is being used by another process” error.

  • Another process is using the file

    The file may actually be busy performing another action and may be inaccessible during that time.

  • The “ListenOnlyList” Registry key is configured incorrectly

    If you encountered the error while trying to right-click a site in IIS Manager, then there might be an issue with the associated Windows Registry key.

  • The file is being blocked by a security software

    It may be possible that security software, such as Windows Security or third-party antivirus, may be blocking the file from being accessed, resulting in the error message.

  • Store the file locally

    If the error is occurring due to the fact that a file is downloading from a torrent client into a location shared with online storage, it can cause a conflict between them. Try changing the download location to a non-cloud storage space to resolve the issue.

These are the probable causes for the “The process cannot access the file [File Path] because it is being used by another process” error.

Let us now continue to see how to resolve it.

Fix “The Process Cannot Access The File Used by Another Process”

Close Interfering Process

The error message itself states that the issue is occurring because a file is being used by another process. It only makes sense to close the other process interfering with your work.

That said, the error prompt does not state which process or app is interfering with the file. Therefore, you should close all relevant apps and programs that may relate to the file.

You can close the interfering apps and processes using the Task Manager:

  1. Open the Task Manager by pressing the CTRL + Shift + Esc shortcut keys.

  2. In the Process tab, right-click the app/process you think may be interfering with the file and click “End task.”

    End interfering task from Task Manager
    End interfering task from Task Manager

We suggest that you close all apps and processes using the steps above that are not in use. This will reduce the risk of the error occurring again.

Once closed, re-perform the task and check if the issue has been mitigated. If it persists, continue to perform the remaining mitigation tasks below.

Run the Program with Administrative Privileges

If you encounter the “The process cannot access the file [File Path] because it is being used by another process” error while attempting to run a piece of code in an IDE or a command line, then try running the app/program with elevated privileges.

Limited rights over the file can cause the said error to occur. Therefore, running it as an administrator may do the trick.

You can run an app or a program with elevated privileges using a keyboard shortcut. Press the CTRL + Shift keys from the keyboard and then double-click the app icon. Alternatively, you can also use the Task Manager to run a process/exe file as an administrator:

  1. Open the Task Manager by pressing the CTRL + Shift + Esc shortcut keys.

  2. Click “Run new task.”

    Run a new task
    Run a new task
  3. Enter the file name or the complete path to the program, check the box next to “Create this task with administrative privileges” and click Ok.

    Run program with elevated privileges from Task Manager
    Run a program with elevated privileges from Task Manager

Both of these methods will open the app as an admin, but only temporarily. To learn more methods (permanent and temporary) to run a program as an administrator , refer to this guide post.

Disable all Security Software

Security software, such as Windows Defender or third-party antivirus, may be blocking the file from being accessed, resulting in you not being able to act on it. Try disabling all security software on your Windows computer, both third-party as well as Windows Security.

If you are using a third-party antivirus software, open its console to disable it. To temporarily disable Windows Security, use these steps:

  1. Navigate to the following:

    Settings app >> privacy & security >> Windows Security >> Virus and Threat Protection
  2. Click on the “Manage settings” under the “Virus & threat protection” section.

    Manage virus and threat protection settings
    Manage virus and threat protection settings
  3. Toggle the slider under “Real-time protection” to the Off position.

    Disable real time protection
    Disable real-time protection

    If prompted with a UAC, click Yes.

Now that Windows Security is disabled, try performing the action again to see if you are still prompted with the error message.

If you do not wish to disable Windows Security entirely, you can also add the path to the file to the Windows Security exclusions.

Add File/Folder to Windows Security Exclusion

This solution is an alternative to disabling Windows Security entirely. It can be allied to the complete folder where the file problematic file exists, or to the folder where you are attempting to download a file using a torrent.

Use these steps to add the folder to the Windows security exclusion list:

  1. Go to the following:

    Settings app >> privacy & security >> Windows Security >> Virus and Threat Protection
  2. Click “Manage settings” under Virus & threat protection settings.

    Manage virus and threat protection settings
    Manage virus and threat protection settings
  3. Scroll to the bottom and click “Add or remove exclusions” under the Exclusions section.

    Add or remove Windows Security exclusions
    Add or remove Windows Security exclusions
  4. Click “Add an exclusion,” and then click “Folder” from the expanded menu.

    Add a folder to exclude
    Add a folder to exclude
  5. Now search and select the problematic folder containing the file that causes the error prompt.

Once the folder has been excluded from Windows Security, try performing the task again.

Allow App through Firewall

This solution applies if you are experiencing the error while performing an action on the network, like moving files from one location to another over the network.

It may be possible that your system’s firewall is blocking the app and all of its processes. To fix this, you must allow the app through the firewall. Here is how:

  1. Open Windows Firewall settings by typing in “firewall.cpl” in the Run Command box.

    Open Firewall settings
    Open Firewall settings
  2. Click “Allow an app or feature through Windows Defender Firewall” on the left.

    Allow app through Windows Firewall
    Allow app through Windows Firewall
  3. Click “Change settings.”

    Change firewall settings
    Change firewall settings
  4. Check the boxes for all network types in front of the app throwing the error.

    Allow the app through Windows Firewall
    Allow the app through Windows Firewall
  5. Click “Ok” to save the changes.

    Save and implement the changes
    Save and implement the changes

Once the application has been allowed through Windows Firewall, check to see if the error message has been mitigated and that you are now able to perform the required task.

Restart Torrent Client Software

If you encountered the “The process cannot access the file [File Path] because it is being used by another process” error message while trying to download a torrent file, a simple fix might work.

Restart the torrent client (like BitTorrent or uTorrent) simply by closing it, and then rerun it. This usually fixes the problem as reported by some users.

If this didn’t work for you, then try re-downloading the file to a local location, and not directly to the cloud storage.

Perform a Local Torrent Download

This solution applies if the error is prompted when trying to download a torrent file directly to a cloud location.

If so, try downloading the file locally onto your PC instead, and not on OneDrive, DropBox, or any other cloud storage locations.

For this, you must first delete the torrent and its data, then re-download it locally. Here is how:

  1. Open the torrent client, and right-click on the torrent being downloaded.

  2. From the context menu, expand “Remove and” and then click “Delete torrent + data.”

    This will remove the torrent as well as any data which has already been downloaded.

  3. Now re-download the torrent file and run it.

  4. Select a local download location and begin your download.

Set a different IP Range when using Netsh Command

There are also reports that the “The process cannot access the file because it is being used by another process” error is prompted when attempting to resolve a DNS conflict using the Netsh command. If you find yourself in a similar situation, then try a different approach instead.

Instead of resolving the DNS conflict by excluding an IP or an IP range, try setting a totally different IP range instead.

To do so, you can run the following cmdlets in an elevated terminal:

netsh int ipv4 set dynamicport tcp start=10000 num=1000
netsh int ipv4 set dynamicport udp start=10000 num=1000

After changing the IP address range, check to see if the error is resolved.

Fix IIS Port Conflict

This solution is for when you are experiencing the aforementioned error while right-clicking a website in the IIS manager. This happens when there is a port conflict. This error has been reported with IIS versions 6.0 and 7.0.

Either one of the following conditions can cause the error:

  • The ListenOnlyList registry subkey is not configured correctly.
  • Another process is using the TCP port (80) or the SSL port (443).

In this case, you must manually change the associated Windows Registry to resolve the issue. But before that, we must check whether ports 80 and 443 are, in fact, being used or not. If they are not in use, then the issue might be something else.

Moreover, we must also temporarily stop the HTTP service on your computer to make changes to the ListenOnlyList key inside the registry.

Use this step-by-step guide to perform the mitigation solution:

Note: Misconfiguration of critical values in the system’s registry could be fatal for your operating system. Therefore, we insist that you create a system restore point before proceeding forward with the process.

You can also use our top selection of disk imaging and backup software so you never lose your data or operating system again.

  1. Run the following command in an elevated Command Prompt to check if ports 80 and 443 are in use:

    netstat -ano
  2. Browse through the resulting list to see if ports 80 and 443 are “LISTENING.”

    Check if ports 80 and 443 are in use
    Check if ports 80 and 443 are in use

    If another process is using the ports, continue to perform the remaining steps below to resolve the port conflict.

  3. Run this cmdlet to stop the HTTP service:

    net stop http
    Stop HTTP service from Command Prompt
    Stop HTTP service from Command Prompt

    When asked for confirmation, enter “Y.”

  4. Now open the Registry Editor by typing in “regedit” in the Run Command box.

    Open the Registry Editor
    Open the Registry Editor
  5. Paste the following in the navigation bar and hit Enter for quick navigation.

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList
    Navigate to ListenOnlyList key
    Navigate to the ListenOnlyList key

    Note: If the “ListenOnlyList” key does not exist, creating one is unnecessary as the “0.0.0.0” IP address will be used by default.

  6. Right-click any invalid IP address inside the “ListenOnlyList” key and click “Delete.”

    Delete invalid IPs in ListenOnlyList
    Delete invalid IPs in ListenOnlyList
  7. Once all invalid IP addresses have been removed, restart the computer.

    The HTTP service should also start automatically when the computer reboots.

Once the port conflict is resolved, the “The process cannot access the file” error should be removed as well.

Final Thoughts

The error message reading “The process cannot access the file because it is being used by another process” can be infuriating to resolve. The solutions to resolve this error are entirely dependent on the circumstances and conditions when it was encountered.

In this article, you will find all the possible solutions to resolve the said error, may it be in the IIS manager, or while attempting to download a file through a torrent.

Let us know which solution(s) worked for you in the comments below and when the error first occurred.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information