Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have shared a drive with Operating system: Windows Server 2008 R2 Enterprise Service Pack 1, then write some c++ codes to access this drive with windows API (WNetAddConnection2) from other computers in my organization through HTCondor (could be any windows system from XP to 8).

In some cases, the connection is successful and coping files from share drive, but the connection is suddenly failed. Finally, I cannot delete the files in my share drive.

I have to restart the shared computers and delete the files.

How could I delete files without restarting? Please let me know if my question is not clear.

Thanks for any suggestions.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Do you have physical access to the machine? If yes, since you know it is a network connection that is locking the file, you could temporarily disable the network connection which should release the locks. If you are accessing the computer remotely then this option obviously won't work since you'll lock yourself out too.

You can also use handle, which should show you which windows process has the file locked. Then you can kill just that process to release the handle (lock) on that file. Beware though that if the process you are killing is a necessary windows process, then this could cause instability, in which case you probably would end up needing to do a reboot anyway to recover.

share|improve this answer
    
Thanks for your suggestion. This is a virtual machine which have to be connected with remote desktop. Handle could be the best option for me now. Disable the shared drive could be another options. But it will be boring to reset permissions, etc. –  Helend Jun 18 '14 at 4:39
    
I just noticed the system process with pid: 4 is handling the shared files. –  Helend Jun 18 '14 at 4:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.