-1

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?

Thanks

2 Answers 2

6

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.

1
  • 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, 2014 at 20:45
4

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.

Not the answer you're looking for? Browse other questions tagged .