How to Lock a Folder in Windows Using Cmd!

by ALEEF02. in Circuits > Microsoft

23361 Views, 5 Favorites, 0 Comments

How to Lock a Folder in Windows Using Cmd!

7.PNG

In this tutorial, I'm going to show you how to lock a file or folder in CMD!

Disclaimer: Using the program attached or using the commands incorrectly could lead to all files being locked and an unusable machine. By downloading the program, using the commands used in this tutorial, or reading on, you agree that the maker is not responsible for any damage/malfunction to your machine or data loss

tags: lock folder, lock folder in windows, lock folder Windows, lock folder in CMD, lock file, hide file, hide folder in Windows, lock file in Windows, lock folder Windows, lock file in CMD, lock file in command prompt, lock folder in command prompt

Method 1: Download My Program

Download the attached file and run it. If you are not comfortable doing this or you want to strictly use the command prompt only, proceed to Method 2, which is located at step 10.

Downloads

Run the File

2.PNG

We're first going to lock a file. Run the program and type "L" to lock and enter

Type the Name of the File

3.PNG
15.PNG

Now type the name of the file. My test file is named testdoc.txt. Make sure to add the file extension. If you don't know the file extension, go to "view" and click the box shown in the photo

Type the Path of the File

4.PNG

Now type the path of the same file. My testdoc.txt is located at c:\Users\Michael\Desktop\Cool\testdoc.txt.

Comfirm Path

5.PNG

Now confirm that the path is correct. If it is not, type "N" to start again. NOTICE: If the path is incorrect, files may be locked and may not be able to be unlocked. ALSO: Typing C:\ or C:\windows or C:\Users ect. will lock you out of your computer! SO DON'T DO THIS! But, as long as the path only specifies the folder or file, you have nothing to worry about.

Now Your File Has Been Locked and the Icon Has Been Changed to a "No Symbol"

6.PNG
7.PNG

If you want to see the original file, click view then click the box shown in the picture. Upon running either the hidden file or the shortcut, you will see that it is locked and is accessible!

Unlocking the File or Folder

9.PNG

Now open the program again, and type "U" to start unlocking. If you want to prevent others from unlocking the files, hide the program that you downloaded in a separate folder.

Type the Name of the Locked File or Folder

10.PNG

Now type the name of the file. We're unlocking testdoc.txt.

Type the Path of the Locked File or Folder

11.PNG
1.PNG

Now type the path of the same file. My testdoc.txt is located at c:\Users\Michael\Desktop\Cool\testdoc.txt. After that hit enter and your file or folder is unlocked!

Method 2: Using Commands in CMD

18.PNG

Open the cmd by typing the windows key+r and type "cmd" or in the search box in windows or click the start button and search for cmd.

Locking

13.PNG

To lock your file or folder type cacls "File Path" [/t] /e /p everyone:n. The /t is used to lock all folders and files within a folder. My file is located at C:\Users\Michael\Desktop\Cool\testdoc.txt, so I will type cacls "C:\Users\Michael\Desktop\Cool\testdoc.txt" /e /p everyone:n.

Now Your File Is Locked

14.PNG

Now the file or folder is locked. Upon opening, you will see that it won't open.

Unlocking

16.PNG

To unlock your file or folder type cacls "File Path" [/t] /e /p everyone:f. You must use the [/t] if you used it before. My file is located at C:\Users\Michael\Desktop\Cool\testdoc.txt, so I will type cacls "C:\Users\Michael\Desktop\Cool\testdoc.txt" /e /p everyone:f.

Done!

Now you know how to lock and unlock files and folders using the cmd! Make sure to share this with friends!