0

I had used a .bat file to hide some of my files but now I can not locate that .bat file using which I used to open my hidden directory. How can I get my files back? The files were in C drive.

I have used below codes in .bat file:

cls
@ECHO OFF
title Folder Private
if EXIST "HTG Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER

:CONFIRM
echo Are you sure you want to lock the 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 "HTG Locker"
attrib +h +s "HTG Locker"
echo Folder locked
goto End

:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "HTG Locker"
ren "HTG Locker" Private
echo Folder Unlocked successfully
goto End

:FAIL
echo Invalid password
goto end

:MDLOCKER
md Private
echo Private created successfully
goto End

:End
4

All you have done in your script is rename "Private" to "HTG Locker" and turn on the hidden and system attributes.

You can simply go to File Explorer options, select "Show Hidden Files", untick "Hide Protected Operating System Files" and you can see it.

If you don't know where it is, after doing that, search for folders on C volume called "Private" or "HTG Locker".

File Explorer Options

It isn't a terribly secure way of hiding things really.

2
  • thanks for the reply. Actually I have lost the .bat file and I have tried your suggested fix but still I am not getting any files/folder as named Private. I think somehow the .bat file is deleted and I don't know what happens to those hidden files. – Nishant Kashyap Jan 23 '19 at 20:20
  • 1
    Hidden files aren't affected at all by deletion of the .bat file. If they were there, they are still there, just hidden. If they aren't there, then they were deleted somehow or you're looking in the wrong place. The .bat file is unrelated. – gronostaj Jan 23 '19 at 21:16
0

You can search based on the content of the file and not just the name. In the search box in File Explorer, type content: and then type something that should be in the file. If it's there, you should be able to find it. Be sure you're searching the folder where you expect it to be or the entire drive.

4
  • I have used this content:xxx... search option but no luck. I think the .bat file is somehow deleted and that is also not in recycle bin. Is there any way to restore the files that was hidden?? I can not recall the file names but those were zipped. I have also tried to search for all zip files, but no luck. – Nishant Kashyap Jan 23 '19 at 19:47
  • You might be able to right-click on the folder where the file was and choose Previous Versions but that depends if it's set up or not. – HazardousGlitch Jan 23 '19 at 20:06
  • I don't think that I can go to previous versions as the option is not coming on right click. Could you please tell me where the files goes whenever we try to hide them using those .bat command that I have mentioned above? – Nishant Kashyap Jan 23 '19 at 20:12
  • @NishantKashyap They don't go anywhere. You have just hidden them without moving them. – DavidPostill Jan 23 '19 at 21:32
0

You can try to unhide all files by executing this command inside the parent folder:

attrib -h -s *

Go to the folder which contained your "HTG Locker" folder and execute this command. If you still can't see your folder after this, it was probably deleted somehow (not by the .bat file you posted in your question though - that batch file only creates/renames/hides folders).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.