Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
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%== 12345 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

In above code is a .bat file for hiding folder using dos command in windows 7.In this above code it showing my password(12345) while right click and select edit option.

How to make this password as md5 or encrypted manner or make this password as invisible?i have tried many times for changing that string into md5 but it doesn't work. Is there any other way to protect folder with encrypted password without using 3rd party tools using dos

share|improve this question
2  
Do you realize that this is “security through obscurity”; i.e., not real security? It is easy to see hidden system files if you want to. –  Scott Feb 11 '13 at 19:26
    
This is just such a bad idea. Why not use Truecrypt containers instead? it's secure. This will never be. Anyone can look at the hidden files without the password so encrypting the password adds nothing. –  Matt H Apr 17 '13 at 5:06
add comment

3 Answers 3

There is no point in making the password invisible. The reason is the password adds nothing to the security. Actually, the whole batch file is pointless.

We can assume you are setting this up to prevent other people who have access to that computer from viewing the files. However, all they have to do is view the batch file to see that you are using the attrib command to create a hidden folder. All they have to do is type attrib from the command prompt and they can see all the hidden and system files and folders, or just turn on "show hidden files and folders" in Explorer.

You are better off using account based ACLs, or if you are really paranoid, a true encryption program.

share|improve this answer
    
I'd have to agree this is really bad. –  Matt H Apr 17 '13 at 5:04
    
I saw HTG in the batch file... searched the HowToGeek... yes its there... not sure why. They even comment thats its rather useless. Not sure why they would even post it. –  Keltari Apr 17 '13 at 6:40
add comment

I believe that I found what you want:

@echo off
echo Enter password:
set /p "pass=>"
echo %pass%> pword.tmp
for /F %%M in ('md5sum pword.tmp') do (
    del pword.tmp
    if NOT %%M==03043fe01867a075a47e2e6f08ddf7fa (
        echo Invalid password.
        exit /b
    )
)

echo Success!

You know about reading the password from the console.  Sadly, I have to write the password to a file.  (Try to use a directory that nobody but you has access to, if there is such a thing.)  Then I run the md5sum command on the file, and capture the output (i.e., the MD5 checksum) into %%M by using a kludgy for loop (it should iterate only once).  I should have been able to do echo %pass% | mdsum, which would be more secure less insecure, but I couldn’t get it to work.  Then compare the hash of the password entered by the user with the pre-computed hash of the password you want to accept.

03043fe01867a075a47e2e6f08ddf7fa is the MD5 hash for “Swordfish”.

share|improve this answer
add comment

You can use your own variable. Add this code in the starting.

Set 1= apple
Set 2= ball
Set 3= cat
Set 4= dog
Set 5= elephant

And in the password space you write

%apple%%ball%%cat%%dog%%elephant%

You can use this and you have an encrypted password. You can also use other words instead of these

share|improve this answer
    
hello friend,thank for your reply.but i want to show password "827ccb0eea8a706c4c34a16891f84e7b" in this format(md5 format). Because its tough for find password.could you please tell solution for this my friend? –  GiRi NDOT Feb 11 '13 at 7:56
    
well i could not find any solution for md5 encryption... but i recommend you to compile the batch file using this softpedia.com/get/System/File-Management/… well theres an option for encrpting the batch file and your job is done..! hope this helps you... –  Buster Feb 11 '13 at 17:50
add comment

protected by Community Sep 1 '13 at 7:26

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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