FileLocker - a small tool to lock files
Did you also sometimes want to test exception cases and the right tools are missing?
I recently wanted to test a locked file exception in Java but from implementing the test it seems there is no easy way in Windows to lock a file for testing (at least I'm not aware of, hints are welcome...) - so I was writing a small command line tool to help me implementing my test cases.
The FileLocker is a Windows NT/2000/XP/2003/Vista/7 32Bit command line tool to lock a file. The lock is a read/write/delete lock. The lock will be released once you kill the program or after a specified time / keypress.
Usage:
FileLocker [/T LockTime] [/I] [/K] [/Q] file [file...]
| /T LockTime | Time in milliseconds to lock the file |
| /I | Infinite locking until process is killed (default) |
| /K | Lock file until key is pressed |
| /Q | Be quiet. |
| Attachment | Size |
|---|---|
| FileLocker.zip | 15.45 KB |
| FileLockerSource.zip | 9.47 KB |

Exactly what I was looking for!
During development, the need arose to test a case when a local file is locked by another program.
Thanks a lot for this small tool, it simplified my work a lot!