How to Force Delete a File in Windows 10

To force delete a file in Windows 10, first close any app that has it open. Then open Command Prompt, type del /f "C:\path\to\file.txt" using the file’s full path, and press Enter. The /f option deletes read-only files too. Files deleted this way skip the Recycle Bin.

Applies to: Windows 10. Windows 10 reached end of support on October 14, 2025, and only PCs enrolled in Extended Security Updates still get security fixes, through October 12, 2027.

Why a file won’t delete

  • It’s open in an app. Windows says The action can’t be completed because the file is open in another program.
  • It’s read-only, or you don’t have permission to change it.
  • The path is too long, or the name has characters Windows doesn’t expect.

Be careful with files in C:\Windows or Program Files. Deleting them can stop Windows or apps from working.

Close the app that’s using it

  1. Close the app you used the file in. If you don’t know which one, restart your PC and try again.
  2. Or find it: press Windows key + R, type resmon, and press Enter to open Resource Monitor.
  3. On the CPU tab, type the file name in the Associated Handles search box.
  4. Right-click the app in the results and select End Process, then delete the file.
Windows 10 Resource Monitor CPU tab with a file name typed in Associated Handles and the app using it listed
Search for the file (1) to see which app has it open (2).

Only end apps you know. Save your work in them first. Task Manager is another way to close apps; opening Task Manager in Windows 10 shows how.

Delete it with Command Prompt

  1. In File Explorer, hold Shift, right-click the file, and select Copy as path.
  2. Open Command Prompt. For files in protected folders, run it as an administrator.
  3. Type del /f and paste the path, then press Enter.
Windows 10 Command Prompt showing del /f with a quoted file path and dir showing the file is gone
Run del /f with the file’s path (1). Check it’s gone (2).

To delete a folder and everything in it, use rd /s /q "C:\path\to\folder". It doesn’t ask first, so check the path carefully.

Take ownership of a stubborn file

If Windows says you need permission, take ownership in an administrator Command Prompt. Use this only for your own files, not files in C:\Windows.

  1. Type takeown /f "C:\path\to\file.txt" and press Enter.
  2. Type icacls "C:\path\to\file.txt" /grant administrators:F and press Enter.
  3. Delete the file with del /f as shown above.

Delete it with PowerShell

In PowerShell, Remove-Item -Path "C:\path\to\file.txt" -Force deletes a file, including hidden and read-only ones. Add -Recurse to delete a folder and everything in it. Like del, it skips the Recycle Bin.

If it still won’t delete

  • Start in Safe Mode and try again, because fewer apps are running. The steps are in starting Windows 10 in Safe Mode.
  • Check permissions: right-click the file, select Properties > Security, and make sure your account has Full control. If it doesn’t, follow changing file and folder permissions in Windows 10.
  • Long paths: move the folder closer to the top of the drive, like C:\Temp, or rename folders to shorter names, then delete it. Windows 10 version 1607 and later also has a registry setting for this, explained in enabling long paths in Windows 11.
  • File Explorer’s preview pane is holding it: press Alt + P to close the preview pane, then try again.
  • The file comes back: it may be syncing from OneDrive or being recreated by an app. Pause OneDrive or close the app, then delete it.
  • Strange names or very long paths: add \\?\ before the full path, like del "\\?\C:\path\to\file.txt". This tells Windows to skip its usual name checks.

Frequently asked questions

Can I get a force-deleted file back?

It doesn’t go to the Recycle Bin. You may be able to restore it from a backup, as explained in recovering permanently deleted files in Windows 10.

Is it safe to force delete files?

Yes, for your own files. Check the path twice, since there’s no undo. Don’t force delete files in Windows or Program Files folders; uninstall the app instead.

Why does Windows say the file is open when nothing is running?

A background task may be using it, such as a virus scan, a backup, or File Explorer making a thumbnail. Wait a minute, or restart the PC, and then delete it.

Where do normally deleted files go?

To the Recycle Bin. Finding it is covered in accessing the Recycle Bin in Windows 10.

Command details are on the del page, and more causes are listed in You can’t delete a file or a folder on an NTFS file system volume.