If you want to keep a file locked, you need to do something different in Windows than in other operating systems. In Windows, you can lock files by using the File Manager or by using the command line. The File Manager is a program that is part of the Windows operating system. The File Manager can be found on the Start menu. The File Manager is a program that lets you lock files and folders, as well as create and manage files and folders. To use the File Manager, open it and click on the three lines that are located at the top of the screen. This will show you a list of all your currently locked files and folders. To unlock a file, just click on it and it will be unlocked.


While there are plenty of third-party programs to accomplish a task, sometimes you just want to use a built-in method to do the same thing. Today’s SuperUser Q&A post helps a reader find an awesome built-in solution to keep his files from being deleted or overwritten.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Notepad screenshot courtesy of Dan (SuperUser).

The Question

SuperUser reader boboes wants to know if there is a built-in method in Windows 7 and newer editions to lock a file and keep it from being overwritten or deleted:

Is there a built-in method for doing this in Windows 7 and newer editions?

I know that there are programs for doing this. My question is if there is a built in mechanism in Windows 7 and newer editions. Sometimes I have to check a script on a PC and do not want to install new programs for that.

There are also some good suggestions here: How to purposefully exclusively lock a file? Unfortunately, they require 3rd party tools or changing the file to a locked state.

The Answer

SuperUser contributors Dan and Breakthrough have the answer for us. First up, Dan:

Followed by the answer from Breakthrough:

While paused, the above script causes the following prompt when attempting to open up “myfile.txt”:

Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.