views:

24

answers:

1

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?

A: 

These methods require a reboot: How to replace in-use files at Windows restart

gwell
Are you sure about that? Seems to me that the actual operation is possible as long as HomeServerConsole.exe is killed. If I can get another process to do the actual operation after I killed HomeServerConsole (and consequently my own add-in). Maybe if I can start a process from my add-in and then close myself leaving the started process running? Are you with me?
Björn Andersson