CMD-FILE-IN-USE

Command Prompt "The Process Cannot Access the File Because It Is Being Used by Another Process" Applies to: Windows 7, Windows 10, Windows 11

What it means

Another program currently has the file open or locked, preventing the command from modifying or deleting it.

Also seen as: being used by another process

Quick fix steps

  1. Close any program that might have the file open, including background apps you might not immediately think of.
  2. Use tasklist to check for a process that might be holding the file, and taskkill to close it if you can identify it confidently.
  3. If the file is still locked with nothing obvious holding it, a restart will release almost any lock that a normal close won't.
For the full step-by-step walkthrough, see Using tasklist and taskkill to Find and Close Frozen Programs.

Frequently Asked Questions

How do I know which program has the file open?
Resource Monitor (search "resmon") has a CPU tab with a "Associated Handles" search that can show you exactly which process has a specific file locked, which is more precise than guessing.
Is it safe to force-close the program holding the file?
Generally yes, though you'll lose any unsaved changes in that specific program — saving your work there first, if possible, is the safer approach before force-closing it.

Other error codes