0

A while back, I found this code to create a batch file that puts a password lock on a folder.

@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock Your Secure Folder
set/p "pass=>"
if NOT %pass%== wonderhowtogoto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDPrivate
md Private
echo Private created successfully
goto End
:End

Today, the file got corrupted and it continues to give me the message "The filename, directory name, or volume label syntax is incorrect." when I try to open it with the command prompt. I'm trying to find out if there is a way to either fix the batch file, or locate the locked folder so I can just transfer it to a hard drive and store it away. Any help is appreciated.

  • It also doesn't lock the folder. Anyone can access it. –  Apr 12 '20 at 20:51
  • There's a space missing in `if NOT %pass%== wonderhowtogoto FAIL` – Stephan Apr 13 '20 at 10:08
  • To be fair @Stephan, a password was never created for the directory in the first instance! The answer to your question Spencer, is that with your script working properly, the hidden and system directory, should, unless it's since been moved, still be located in the directory which was current when the batch file was run. Unless we knew how that batch file was being run each time it was used, however, we cannot tell you what the current directory was at that time. – Compo Apr 13 '20 at 13:22
  • @Compo: the password has nothing to do with the folder. It's just to "allow unlocking" (questionable if putting the password in clear text into the batchfile is helpful though). (Also that typo isn't the reason for the mentioned error) – Stephan Apr 13 '20 at 17:22

1 Answers1

0

They're still in the folder. It's just renamed so that Windows Explorer can't open it. To manually unlock it, run these commands from it:

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private