Unable to access file that is in use
I have written an Add-in for Windows Home Server Console that is supposed to copy and replace some files among other things.
The problem is that one file is already used by HomeServerConsole.exe and therefore I cannot replace it with another. I get "Cannot access file because it's being used by another process".
I'm not sure how to solve this. My first idea was to programmatically close HomeServerConsole.exe and lauch another simple program to do the replacing. How do I do that though?
Another idea was to somehow get HomeServerConsole.exe to unlock the file for me to do my thing and then handing it back to开发者_开发问答 HomeServerConsole. But how?
I've also begun looking at Win32Api to solve the problem but haven't yet found a solution.
How would you go about solving it?
These methods require a reboot: How to replace in-use files at Windows restart
精彩评论