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
Step 1: 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.
Step 2: Run the File
We're first going to lock a file. Run the program and type "L" to lock and enter
Step 3: Type the Name of the File
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
Step 4: Type the Path of the File
Now type the path of the same file. My testdoc.txt is located at c:\Users\Michael\Desktop\Cool\testdoc.txt.
Step 5: Comfirm Path
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.
Step 6: Now Your File Has Been Locked and the Icon Has Been Changed to a "No Symbol"
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!
Step 7: Unlocking the File or Folder
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.
Step 8: Type the Name of the Locked File or Folder
Now type the name of the file. We're unlocking testdoc.txt.
Step 9: Type the Path of the Locked File or Folder
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!
Step 10: Method 2: Using Commands in CMD
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.
Step 11: Locking
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.
Step 12: Now Your File Is Locked
Now the file or folder is locked. Upon opening, you will see that it won't open.
Step 13: Unlocking
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.
Step 14: Done!
Now you know how to lock and unlock files and folders using the cmd! Make sure to share this with friends!