How can I unlock files that I locked with FolderLocker.bat?

Anonymous
2025-03-07T07:37:34+00:00

Hello everyone,
I encrypted my important data with the instructions on the internet and everything was fine. I had to reinstall Windows on the system. Since replacing Windows, I cannot access the files, folders, and photos that I encrypted and it shows me this error: Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.. I will share some sample images of these errors with you.
Thank you for your help.

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
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-08T06:20:31+00:00

    Dear AmirMahdi AlaeiTabar!

    Welcome to the Microsoft Community!

    I read your post and you mentioned that you used a batch file called FolderLocker.bat to encrypt important data. Now after reinstalling the Windows system, you cannot access these files because of permission errors. First, I need to figure out how FolderLocker.bat works, because different scripts may use different encryption or locking methods. Common batch encryption methods may include modifying file attributes, using system permission settings, or more complex encryption algorithms. But according to the situation described by the user, it is possible that this script only "locks" files by modifying the permissions or hidden attributes of files or folders, rather than real encryption.

    The following are possible solutions to the problem that FolderLocker.bat locks files and cannot be accessed:

    I. Core cause analysis

    Since you use a custom batch script (FolderLocker.bat) to lock files, the principle is usually achieved in the following two ways:

    1. Modify file/folder permissions: Set the access rights of the target object to allow only specific SIDs (user security identifiers) to access.
    2. Set hidden attributes + system permissions: Hide the file through attrib +s +h and remove the access rights of all users.

    Reasons for failure after reinstalling the system:

    The user SID of the new system is different from that of the old system, resulting in permission verification failure.

    The batch script may not back up the original permissions or encryption keys.

    II. Manual recovery plan

    1. Force file ownership

    1. Right-click the locked file/folder → Properties → Security → Advanced.
    2. Click "Change" to the right of "Owner" → Enter the current user name → Check the name → OK.
    3. Check "Replace owner of subcontainers and objects" → Apply → Confirm all pop-ups.
    4. Return to the Security tab → Click "Edit" → Add the current user → Check "Full control" → Apply.

    2. Use the command line to reset permissions

    Run CMD with administrator privileges:

    takeown /f "file path" /r /d y 
    
    icacls "file path" /reset /t /c /q 
    

    Example (the specific path is subject to your file path):

    takeown /f "D:\SecretData" /r /d y 
    
    icacls "D:\SecretData" /grant Everyone:F /t /c /q 
    

    3. Remove hidden attributes

    Run CMD as an administrator:

    attrib -s -h "file path" /s /d 
    

    Example:

    attrib -s -h "D:\SecretData\*.*" /s /d 
    

    III. Data recovery service

    If the above method does not work, please contact a professional data recovery agency immediately and provide the following information:

    Device model: hard disk brand and interface type (such as SATA/NVMe).

    Locking method: Provide the FolderLocker.bat script content (if there is a backup).

    Fault phenomenon: Error screenshot and system log (%SystemRoot%\System32\winevt\Logs\Security.evtx)

    IV. Preventive measures

    1. Use reliable encryption tools:

    Use VeraCrypt (open source encryption)

    Or BitLocker (Windows built-in)

    2. Regularly back up permission configuration:

    icacls "D:\Data" /save "D:\Backup\Permissions.acl" /t /c 
    

    In order to avoid similar problems from happening again, it is recommended that you regularly back up important data and use reliable security measures to protect your files.

    Appendix: Risk operation warning

    Operation Risk level Probability of data loss

    Directly format the partition Very high 100%

    Use CHKDSK to force repair High 30-70%

    Third-party tool misoperation Medium 10-20%

    Please try option 2 first. If it still cannot be solved, stop the operation immediately and hand it over to a professional organization for processing. Data is priceless, please operate with caution!

    I sincerely hope that the above troubleshooting steps and related information can help you. If you have any questions, please feel free to post in this thread. Although our responses are not real-time, I will be happy to work with you to resolve the problem if we have more information and further progress in troubleshooting.

    Thank you for your understanding and support! 

    I wish you all the best.

    Best regards,

    Yang.Z - MSFT | Microsoft Community Support Specialist

    0 comments No comments