Skip navigation

JSI Tip 8261. You may be able to delete a file without shutting down when the shell returns an 'access denied'?


The recommended way to delete a file that is in use is to run Inuse.exe, which is in the public domain. Unfortunately, this requires that you restart your computer.

If the file is being used by the shell, Explorer.exe by default, you may be able to use the following procedure:

NOTE: DO NOT close any window unless instructed.

1. Close all your open programs.

2. Open a CMD.EXE window.

3. Press Ctrl+Shift+Esc to open Task Manager (Taskmgr.exe).

4. Select the Processes tab. If their are no tabs, double-click the top border.

5. Select the Explorer.exe process and press End Process. This will close the shell.

6. In the CMD.EXE window that you opened in step 2, type:

CD /d "<Drive:>\Folder"
del /f /q /a "FileName"

pressing Enter after each line, where "<Drive:>\Folder" is the quoted path to the folder that contains the file you wish to delete, and FileName is the quoted file name, with extension, to be deleted.

7. Close the CMD.EXE window.

8. In Task Manager, use the File menu and press New Task (Run ...).

9. Type Explorer.exe into the Open box of the Create New Task dialog, and press OK to restart the shell.

NOTE: When you close the shell in step 5, your desk top will disappear.

Example:

If you need to delete C:\Documents and Settings\Jerry\program.exe, in step 6 you would type:

CD /d "C:\Documents and Settings\Jerry"
del /f /q /a "program.exe"



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish