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)
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityI'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)
There's a free utility called Easy File Locker that could work.
Find it at: http://www.xoslab.com/efl.html
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.
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.