Locking files for testing

Getting errors when trying to access locked files is a common situation that must be addressed by programs.  On Windows machines it’s fairly easy to replicate the scenario of a locked file using a simple technique that I picked up recently.  Simply run the following command with notepad.

notepad >> filename.txt

The file will remain locked until Notepad is closed.  No need to an additional tool or utility to apply a lock to a file.

This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *