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.
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.
- Press Windows key + R to open a Run dialog box. Then, type “cmd” and press Ctrl + Shift + Enter to open an elevated Command Prompt.
- When prompted by the UAC (User Account Control)</strong), click Yes to grant admin privileges.
- 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.
- Search for Command Prompt and run it as an Administrator.
- 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.
- Press Windows key + R to open a Run box, type “cmd“, and press Ctrl + Shift + Enter to open an elevated Command Prompt.
- Run the command:
netstat -ano
Scroll to see if ports 80 and 443 are used by any process.
Note: If they are used, find steps online to resolve this.
- If the ports aren’t used, close the Command Prompt.
- Press Windows key + R, type ‘regedit‘, and press Enter to open the Registry Editor. Confirm any prompts.
- Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList
Note: If absent, IP 0.0.0.0 is used by default.
- Press Windows key + R, type ‘cmd‘, and press Enter.
- Run the command:
net stop http
Type ‘Y’ to confirm.
- Back in the Registry Editor, ensure ListenOnlyList has valid IPs. Remove any invalid ones.
Note: If 0.0.0.0 is listed, remove other IPs.
- Close the Registry Editor and restart your computer.
- To ensure the HTTP service is running, press Windows key + R, type “cmd“, and press Enter.
- Run the command:
net start http
Note: If you see “The requested service has already been started,” it is running.
- 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.