Disclaimer: I am mainly a linux/web developer.
Windows has this "nice" feature where it denies permission to delete any file that is held open by any process. So if an antivirus hits the wrong file at the wrong time, some random program might misbehave and possibly crash.
Am I right? Are there plans to fix this?
Do any of you find this acceptable, or, how could it possibly seem a good idea at the time?
Edit:
It works very differently on Unix, and has been so for decades.
As an example:
Actually, a common usage pattern for temporary files on Unix is: open-remove-read/write-close.
If the file you want to delete is in an “exe” file of a program, try closing the program first, then attempt to delete the file again. You can also try restarting your PC to close down any running programs or closing the apps that might be using the program you want to delete.
End the Application via the Task Manager This is the most promising method to fix the "file is open in another program" error. Click Ctrl + Shift + ESC to open the Task Manager. Alternatively, you can press Ctrl + Alt + Del or right-click the Taskbar and select Task Manager.
In the command window, type the DEL /F file name command and press Enter to force delete the file that is in use.
Your initial statement is not correct. Windows does allow open files to be deleted. You just have to specify FILE_SHARE_DELETE and you're all set. Careful programmers should sensibly decide if that flag (or sharing for reading/writing) make sense and pass it.
An anti virus product that does not open files with full sharing (including deletion) enabled is buggy.
Windows does, however, remember the current working directory of any process and prevents it from being deleted. This working directory is independent of the location of any files opened by the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With