Share via

Batch file folder lock issue in Windows 11

Anonymous
2023-07-24T22:22:11+00:00

I set up batch file lock on a folder in windows 11 and it worked at first but now the folder won't lock when I double click on batch file icon and answer yes (y) to lock (it stays unlocked) I got to lock once after a restart but tried again and won't lock.

<Changed to a question>

Windows for home | Windows 11 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2023-07-25T17:41:39+00:00

    Thanks for the reply. The folder does not have anything overly sensitive or important, that's why I wanted a simple password like WD & Samsung etc external drives offer.

    Apparently it seems to be working now. For some reason last night it wasn't locking except for the first time after it was set up.

    I just went through the locking and unlocking procedure 3 x and it's working fine now.

    1 person found this answer helpful.
    0 comments No comments
  2. Les Ferch 10,326 Reputation points Volunteer Moderator
    2023-07-25T02:20:49+00:00

    How are you "locking" the folder? Are you running Windows 11 Pro and using Bitlocker from the command line or is this a batch file that does an obfuscation such as setting a folder with hidden and system attributes? In other words, I would need to see your batch file to have any hope of debugging it.

    Batch file debugging is a bit beyond the scope of this forum. SuperUser or Elevenforum are better places to post, but I'd be happy to help if you can provide the necessary details.

    1 person found this answer helpful.
    0 comments No comments
  3. Les Ferch 10,326 Reputation points Volunteer Moderator
    2023-07-25T14:16:01+00:00

    The batch file I linked to in my first reply is mostly the same as the one referenced in that video. It simply sets the target folder's attributes to hidden and system and renames the folder to "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}".

    To access your folder, all anyone has to do is show hidden files and system files:

    Image

    Then they will see the folder named "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" and can open it like any other folder. That name does nothing special. It was just chosen in the hope that someone who sees it will think that it's a system thing and not open it.

    Also the batch file is designed to be placed in the same folder as the "Private" folder, which, if used that way, first alerts a snoop to look in that location and provides all the information they need to find and access the folder. At the very least, the batch file should be modified to run from a different location (perhaps you've done that). But the batch file is still plain text, so if it's anywhere on your computer, a snoop could find it and then see that you have a private folder.

    Any type of "security" like this doesn't stop a determined snoop for long even if they have limited computer skills because the batch file is easily found on the Internet by searching generic key words such as "windows folder lock" or "how to hide a folder in windows", etc.

    Anyhow, to answer your original question, the batch file simply checks for the existence of a folder/file named "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" and, if found, it "unlocks" the folder by renaming it back to "Private" and setting the attributes to not hidden and not system. If not found, it "locks" the folder by renaming it to that specific name and setting the attributes to hidden and system. If the batch file is failing to perform these steps, it is most likely because it is not finding the target folder. This could be due to moving the batch file (as I mentioned, it is coded to assume it's in the same location as the "Private" folder) or launching the batch file via another method, such as a shortcut, that is not setting the current folder to the batch file's location. It could also be caused by incorrect editing of the batch file.

    Also note that if you have a "Private" folder on your desktop, you may have to press F5 to refresh the display between hiding and unhiding. I did not see this issue myself, but it's possible.

    Although encryption is really the only way to completely secure your data, I can understand that performance may be an issue for large files, such as movies. In the past, I have looked into some third-party folder and disk locking programs and did find some that worked well and appeared difficult to bypass. They certainly were many levels better than that batch file. However, I haven't looked at such software in a long time and don't have any recommendations. There is an extensive list of such tools at this link. Do note that if such a program were to go wrong in some way, data could be lost (or at least quite difficult to retrieve).

    0 comments No comments
  4. Anonymous
    2023-07-25T10:16:26+00:00

    The locking method is from a You Tube video about how to password protect folders in Windows 10/11 without any software. https://www.youtube.com/watch?v=SfTnDvINg3w&t=327s

    I tried Bitlocker twice and did not like it as this is a Folder on an external SSD and Bitlocker drastically slows down the transfer speed. I don't want encryption only simple password protection as this is somewhat private but not in need of encryption.

    0 comments No comments