MS-DOS and Windows command line lock and unlock commands
The lock and unlock commands allow or deny direct disk access for applications.
Lock and unlock are internal commands that are available in the following Microsoft operating systems.
Lock and unlock syntax
|drive:||Specifies the drive that needs to be locked.|
|drive:||Specifies the drive that needs to be unlocked.|
Lock and unlock examples
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 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.
- See our lock definition for further information and related links on this term.