Applies To:
  • CitectSCADA

Summary:

You want to delete a file, but Windows will not allow it. You may see one of the following messages.

  • Cannot delete file: Access is denied
  • There has been a sharing violation
  • The source or destination file may be in use
  • The file is in use by another program or user
  • Make sure the disk is not full or write-protected and that the file is not currently in use

Usually this is because Windows (specifically the explorer.exe process) has locked the file as it is in use or should not be removed for some other reason.

Normally, there is a good reason and you should not touch the file. But sometimes things behave badly and you need to remove the file.  


Solution:

Kill explorer.exe

This method is rather harsh, but has the definite advantage of not needing any special software to be installed and no need to reboot the system.

  • open a command prompt (START -> RUN, cmd)
  • navigate to the location of the locked file (easy method is to type "cd", then space, then drag the path from the address bar of an explorer window into the cmd window, then press enter)
  • Press CTRL+ALT+DEL, click 'task manager'
  • select the process tab, select explorer.exe and kill it with the 'end process' button
  • go back to the command prompt (ALT+TAB)
  • delete the file (DEL <filename>), use tab for fast completion of file name
  • back to the task manager window
  • select file -> new task, type explorer.exe, click OK

Alternatives:

Process Explorer

Download Process Explorer from sysinternals Press Ctrl+F and search for the filename which is locked. Once found, close the handle of that file, now you can delete it.

Windows Recovery Console

Boot from your Windows install CD, at the welcome screen press 'R' which will start the recovery console. Navigate to the file and delete it. Since Windows is not running at this point the file will not be in use.

There are also very task specific applications available such as 'Unlocker'

 

Keywords:
 

Attachments