[{"data":1,"prerenderedAt":302},["ShallowReactive",2],{"en-post-162":3},{"id":4,"title":5,"body":6,"description":12,"extension":295,"meta":296,"navigation":297,"path":298,"seo":299,"stem":300,"__hash__":301},"content/post/162.md","162",{"type":7,"value":8,"toc":283},"minimark",[9,13,18,21,34,37,41,44,70,73,77,100,104,107,115,118,170,174,222,226,232,235,240,243,248,251,256,263,267,270,276,280],[10,11,12],"p",{},"Try to delete a file and Windows says the operation cannot be completed because the file is open in another program, yet you cannot find anything using it. This is common, and the cause is usually a background process still holding a handle to the file. It is annoying precisely because the culprit is invisible. This guide shows how to find the holder, release it, and delete the file, without reaching for a restart every time.",[14,15,17],"h2",{"id":16},"what-is-a-file-in-use","What Is a File in Use",[10,19,20],{},"A file is in use when a process has it open and Windows will not let it be rewritten or deleted. As long as that handle is not released, a delete request is refused.",[22,23,24,28,31],"ul",{},[25,26,27],"li",{},"A foreground program holds it, such as a document open in Word or a video playing in a player; close the program and the file deletes.",[25,29,30],{},"A background process holds it quietly; an antivirus scan, an Explorer preview, or a browser download can all keep a handle open.",[25,32,33],{},"A special file holds it for its own reason; thumbnail caches, half downloaded files, and files on a USB stick each have their own cause.",[10,35,36],{},"Tell the three apart, then decide whether to close a program, release the handle, or switch to the command line.",[14,38,40],{"id":39},"what-it-does","What It Does",[10,42,43],{},"Knowing how to release a handle saves you from deleting the wrong thing and from unnecessary reinstalls.",[22,45,46,49,52,55,67],{},[25,47,48],{},"Explorer already has the tools; the built in Resource Monitor finds the process, no download needed.",[25,50,51],{},"End just the holder and you do not interrupt anything else.",[25,53,54],{},"A third party tool is the fallback for a file stuck again and again.",[25,56,57,58,62,63,66],{},"The command line forces the delete, with ",[59,60,61],"code",{},"del"," and ",[59,64,65],{},"move"," sidestepping the handle for stubborn directories.",[25,68,69],{},"Find where the lock came from, so you stop rebooting blindly next time.",[10,71,72],{},"Each route keeps the file itself intact until you confirm the delete is what you want, so a wrong click costs you nothing but a moment. Knowing the holder also tells you whether to close an app, stop a service, or leave the file alone until a download ends.",[14,74,76],{"id":75},"when-to-use","When to Use",[22,78,79,82,85,88,91,94,97],{},[25,80,81],{},"Deleting a file says it is open in another program you cannot find.",[25,83,84],{},"A folder looks empty but will not delete, with a message that it is in use.",[25,86,87],{},"Moving or renaming a file is refused because it is locked.",[25,89,90],{},"A file on a USB stick will not delete, or eject says a program is using it.",[25,92,93],{},"A half downloaded file or a player cache will not go away.",[25,95,96],{},"Pictures and videos in a folder have turned to icons, with previews and locks going wrong together.",[25,98,99],{},"An install will not finish because it cannot replace a locked file.",[14,101,103],{"id":102},"before-you-start","Before You Start",[10,105,106],{},"Confirm two things first and you avoid most missteps.",[22,108,109,112],{},[25,110,111],{},"Decide whether you still need the file and make sure it is not important data before deleting.",[25,113,114],{},"Note the file name and its folder path, because Resource Monitor needs one of them to search.",[10,116,117],{},"The release logic is identical on Windows 10 and Windows 11, and the built in tool lives in the same place.",[119,120,121,137],"table",{},[122,123,124],"thead",{},[125,126,127,131,134],"tr",{},[128,129,130],"th",{},"Item",[128,132,133],{},"Windows 10",[128,135,136],{},"Windows 11",[138,139,140,158],"tbody",{},[125,141,142,146,155],{},[143,144,145],"td",{},"Open Resource Monitor",[143,147,148,151,152],{},[59,149,150],{},"Win + R",", type ",[59,153,154],{},"resmon",[143,156,157],{},"Same",[125,159,160,163,168],{},[143,161,162],{},"Open Task Manager",[143,164,165],{},[59,166,167],{},"Ctrl + Shift + Esc",[143,169,157],{},[14,171,173],{"id":172},"step-by-step","Step-by-Step",[175,176,177,180,188,191,194,208],"ol",{},[25,178,179],{},"Try the two easiest moves first. Close the obvious program, or restart and delete the file immediately, since a restart releases nearly every temporary lock. This is risk free and worth trying first, before you install any tool or touch the command line.",[25,181,182,183,151,185,187],{},"Find the holder with Resource Monitor. Press ",[59,184,150],{},[59,186,154],{},", open the CPU tab, and type the file name under Associated Handles. The process that shows up is the holder; make sure it is not critical, end it, then go delete.",[25,189,190],{},"If the holder is Explorer itself, restart Windows Explorer from Task Manager, then try again.",[25,192,193],{},"For a one click release use Unlocker or LockHunter, download from a trusted source, and never use them to force delete system files.",[25,195,196,197,200,201,204,205,207],{},"Force it from the command line. Use ",[59,198,199],{},"del \"path\\file\""," for a file and ",[59,202,203],{},"rmdir /s /q \"path\\folder\""," for a directory; if it refuses, ",[59,206,65],{}," the item to a new name first, then delete.",[25,209,210,211,216,217,221],{},"If it says access denied rather than in use, the lock is not the only problem, so take ownership first; that case is covered in ",[212,213,215],"a",{"href":214},"/post/102/","Folder Access Denied",". For the exact commands and quoting rules, see ",[212,218,220],{"href":219},"/post/88/","CMD Command Prompt and Run Commands (Win+R) Cheat Sheet",".",[14,223,225],{"id":224},"faq","FAQ",[10,227,228],{},[229,230,231],"strong",{},"Will ending a process break the software I am using",[10,233,234],{},"It can. If it holds unsaved work, save first and then end it. Do not close processes you are unsure about.",[10,236,237],{},[229,238,239],{},"Resource Monitor finds nothing for the file name",[10,241,242],{},"Search for the folder name instead, or just the main part of the file name. If it still finds nothing, it is likely a temporary lock a restart will clear.",[10,244,245],{},[229,246,247],{},"Is it safe to force delete system files with an unlock tool",[10,249,250],{},"No. Breaking handles to system files or critical services can destabilize Windows, and those files should not be deleted by hand anyway.",[10,252,253],{},[229,254,255],{},"A file on a USB stick will not delete",[10,257,258,259,221],{},"Eject it safely before unplugging, never yank it out; see ",[212,260,262],{"href":261},"/post/21/","USB Flash Drive or External Hard Drive Not Recognized in Windows",[14,264,266],{"id":265},"how-it-works","How It Works",[10,268,269],{},"Every open file in Windows gets a handle, which a process uses to read and write and which Windows uses to stop two programs editing the same data at once. As long as one handle stays open, deletes are refused, even when the process is hiding in the background.",[10,271,272,273,275],{},"That is why a restart nearly always works: it ends every process and the handles go with them. Resource Monitor reads that handle table backwards, matching a file name to the process still holding it. A ",[59,274,65],{}," works because a rename sidesteps the locked path. Once you see the handle layer, you look for the process instead of clicking delete again and again.",[14,277,279],{"id":278},"conclusion","Conclusion",[10,281,282],{},"A file that will not delete almost always has an invisible process holding a handle. Closing the program and restarting clears most of it; for the rest, find the holder in Resource Monitor or let an unlock tool or the command line finish the job. The line is do not delete the wrong file and do not break system handles. Learn this once and the next in use message tells you who to look for, no staring at the screen and no rush to reinstall.",{"title":284,"searchDepth":285,"depth":285,"links":286},"",2,[287,288,289,290,291,292,293,294],{"id":16,"depth":285,"text":17},{"id":39,"depth":285,"text":40},{"id":75,"depth":285,"text":76},{"id":102,"depth":285,"text":103},{"id":172,"depth":285,"text":173},{"id":224,"depth":285,"text":225},{"id":265,"depth":285,"text":266},{"id":278,"depth":285,"text":279},"md",{},true,"/post/162",{"description":12},"post/162","vgjyPMkZRytxG2yGAO6OBUoSpKiKl7g77Zq-6u1D75A",1794378305102]