1

I'm looking for a convenient little tool that opens a file exclusively so that I can test what happens when our application tries to access it.

OS: Windows 7 and 10 (should be a Desktop application)

1

There's a free utility called Easy File Locker that could work.

Find it at: http://www.xoslab.com/efl.html

0

You could simply drop the file on a VBS script to lock it:

Dim file
file = WScript.Arguments(0)

With CreateObject("Scripting.FileSystemObject").OpenTextFile(file, 1, False, 0)
    WScript.Echo file & vbCr & "Press OK to close the file"
End With

Paste the code in a new text file and save it with the .vbs extension. Then to lock a file, just drop it on the script.

0

Excel will lock a file when it is open. If your file can be opened by Excel and you have Excel on your system this may be an option.

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