How to Fix “The Process Cannot Access the File” Error on Windows

The error “The process cannot access the file” happens when a file is already being used by another program, stopping you from accessing it. This usually means another application or service has the file locked. Common causes include background processes like system services or antivirus scans that keep hold of the file, even if they seem inactive.

The process cannot access the file because it is being used by another process

Additional problems can come from antivirus or backup software that locks files to protect them.

In this article, we will discuss different ways to solve this error.

1. Run the Command with Admin Privileges

Using admin privileges allows a command to bypass file restrictions and access protected or system files. This lets you open files or folders blocked by permissions or background processes, enabling commands that are usually denied with regular access. It’s useful when security rules or system processes prevent file changes or access under normal permissions.

  1. Press Windows key + R to open a Run dialog box. Then, type “cmd” and press Ctrl + Shift + Enter to open an elevated Command Prompt.
    Opening an elevated Command Prompt window
  2. When prompted by the UAC (User Account Control)</strong), click Yes to grant admin privileges.
  3. In the elevated Command Prompt, run the command again and check if you still encounter the error message.

2. Setup a Different IP range

Sometimes, using a different IP range can fix network conflicts that block file access. This change gives unique IPs to devices, reducing overlaps and stabilizing connections. By separating each device’s network path, this helps ensure smoother access to files and resources.

  1. Search for Command Prompt and run it as an Administrator.
  2. Run the following commands:
    netsh int ipv4 set dynamicport tcp start=10000 num=1000
    netsh int ipv4 set dynamicport udp start=10000 num=1000

3. Resolve the IIS port conflict

Resolving an IIS port conflict can solve errors by ensuring two services aren’t using the same port, which can block file access. Assigning a unique port to IIS prevents conflicts with other applications and ensures smoother file operations.

  1. Press Windows key + R to open a Run box, type “cmd“, and press Ctrl + Shift + Enter to open an elevated Command Prompt.
    Opening an elevated Command Prompt window
  2. Run the command:
    netstat -ano

    Scroll to see if ports 80 and 443 are used by any process.

    Verifying if the ports are being used by a different process

    Note: If they are used, find steps online to resolve this.

  3. If the ports aren’t used, close the Command Prompt.
  4. Press Windows key + R, type ‘regedit‘, and press Enter to open the Registry Editor. Confirm any prompts.
  5. Navigate to:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList

    Note: If absent, IP 0.0.0.0 is used by default.

  6. Press Windows key + R, type ‘cmd‘, and press Enter.
    Run dialog: cmd
  7. Run the command:
    net stop http

    Type ‘Y’ to confirm.

    Disabling the HTTP service
  8. Back in the Registry Editor, ensure ListenOnlyList has valid IPs. Remove any invalid ones.
    Deleting the binary values with invalid IPs

    Note: If 0.0.0.0 is listed, remove other IPs.

  9. Close the Registry Editor and restart your computer.
  10. To ensure the HTTP service is running, press Windows key + R, type “cmd“, and press Enter.
    Opening a normal Command Prompt window
  11. Run the command:
    net start http

    Note: If you see “The requested service has already been started,” it is running.

  12. Try starting a service from the IIS MMC snap-in. You should no longer see the “process cannot access the file because it is being used by another process” error.
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.