I'm just wondering if it's possible to force edit a txt file that is currently open and in use in another program. I know that it could be harmful to the program where it is in use but this does not matter.

Any way of doing this and overpowering the "could not save because the file is already open in another program" message?



No, you can't force edit an open file. You could force close it and then edit it. Use Process Explorer to find the process that has an open handle to the file and kill that process.

Of course, this would be potentially very bad for the owner of the other process.

| improve this answer | |
  • 1
    I remember seeing programs that would forcably break file locks. I believe they did it by attaching to each process with the lock and closing the file handle from inside the process. – Zan Lynx Mar 31 '14 at 20:45

File locks are enforced by the OS and there are no way to circumvent them. You can use tools like Process Explorer to find the process which has an open handle on a file and forcibly close it, but this is definitely not recommended; if the process doesn't properly handle the error caused by trying to access a closed handle, it will die quite painfully.

| improve this answer | |

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