The lock and unlock commands allow or deny direct disk access for applications.
Availability
Lock and unlock are internal commands that are available in the following Microsoft operating systems.
Availability
Lock and unlock syntax
Lock and unlock examples
Windows 95
Windows 98
Lock and unlock syntax
LOCK [drive:]
UNLOCK [drive:]
Lock and unlock examples
lock c:
Lock the C: drive
When typing the command above, you will receive the following prompt.
WARNING: The LOCK command enables direct access by programs that can CORRUPT file names and DESTROY disk data, resulting in the loss of files on your disk.
Are you sure (Y/N)?
unlock c:
Unlock the C: drive
If an error is indicating that a process cannot continue because the hard drive is locked, the unlock command cannot resolve these error messages.
Related information
- See our lock definition for further information and related links on this term.