How to Lock Or Hide A Folder, A File Or A Drive On The Computer

These days, hiding or locking a folder or file is probably something you will need if you use a computer that others use too.

A previous post has been written on this topic here but I have found a few other methods of doing such a thing, excluding download programs that can be easily accessible to others.

Here are five other methods:

Windows

Method 1 (the easy one)

    1. Click “Start”, “Run,” and then type cmd. When the command prompt opens type “CD C:Test” (replace “Test” with the name of the folder you want to hide.)

    2. Now type “attrib file +s +h” and replace “file” with the name of the actual file name you would like to hide.

    3. Now, go back to C:Test and look for your file or folder, it’s not there! You cannot find it through simply browsing around, through the command prompt, or even if you click “Show Hidden Files and Folders”.

    4. To find the folder and it’s contents again simply go back to the command prompt, type “CD C:Test” (of course, again replacing “Test” with the name of the folder,) and then type “attrib filename -s -h”. You should now be able to find your file again!

Method 2 (this is where it starts to get slightly more difficult)

This method, unlike the previous one, hides an entire drive instead of individual files or folders:

(Before you ever use the registry I HIGHLY RECOMMEND backing up your registry with a tool similar to Registry Tool or CCleaner. You may as well use a manual method similar to this.)

    1. Go to “Start,” “Run,” and type regedit.

    2. When the registry editor loads, navigate to: HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersion
    PoliciesExplorer

    3. Right click on “Explorer” and select “New” and “DWORD Value.”

    4. Name the value NoDrives and select “Decimal” as the base.

    5. In the value type the number that corresponds with the drive below:

    (E.g. If you would like to hide drive E, type 16. You may also hide multiple drives by adding the two numbers. E.g. If you would like to hide drives E and G, 16+64=80.)

    6. Now, after you restart your computer, you should not be able to see the drive.

Method 3

    1. Create a folder in a drive for easy access, e.g. C:. (Name it something related to the Control Panel, e.g. Users.)

    2. Create a new file in Notepad and copy and paste the following into it:

    ren Users Users.{21EC2020-3AEA-1069-A2DD-08002B30309D}

    3. Replace “Users” with the name of the folder you created and save the file as loc.bat.

    (You should now be able to see your folder and the loc.bat file, with the loc.bat in the same directory as the folder Not in it.)

    4. Now, right-click and create another text file. Copy and Paste the following into it:

    ren Users.{21EC2020-3AEA-1069-A2DD-08002B30309D} Users
    (Make sure to replace the word “Users” with the name of your folder.)

    5. Save it as key.bat.

    6. Now you should see the loc.bat and the key.bat files in the same directory as the folder you created.

    7. Now, all you need to do is double-click on the loc.bat file and the folder should have an icon that looks like the control panel. If you click on the folder it should redirect you to the Control Panel and thus you have locked the folder.

    8. Of course, to unlock it, simply double-click on the key.bat file and the folder should turn back into the folder you first created.

    lock files in windows

Method 4

This final method allows users to hide files in a JPEG image:

hide files in JPEG

    1. Create a folder in C:, e.g. C:Folder1.

    2. Put all the files you want to hide in there, as well as a JPEG image that you would like to hide the files in.

    3. Select all of the files you want to hide, and create a ZIP or RAR file with them using a program like WinRAR, WinZip, 7Zip, etc.

    4. Now you should have your archive next to your files that you want to hide, even though they are in the archived file already, with the JPEG image you would like to hide all of this in.

    5. Go to “Start,” “Run,” and type: cmd.

    6. Now type: cd , then type: cd Folder1. (Of course, replace Folder1 with the name of your folder.)

    7. Type the following: copy /b myimage.JPG + archivedthing.rar myimage.jpg

    (Note: Replace the name “myimage” with the name of your image, and replace “archivedthing” with the name of your compressed file.)

    8. You should receive a response similar to the following: “1 file(s) copied.”

    9. To find the files in your image, all you need to do is right-click on the image and select “Open With…” and select “WinRAR” or the name of the program you used to archive the original files.

    Windows Hide folders

    Hide files in Windows

Mac

Now, for Mac users it is different. The following method can be used for Unix-like systems, thus Macs.

Method 5

    1. Create a folder in your “Home” directory through your directory by typing the following: mkdir .myfoldername The folder has to have a dot before it. E.g. .myfoldername.

    2. Go to your home directory and click “Go” then “Go to Folder.” Type the following: ~/.myfoldername.

    3. You should now be able to put stuff in your hidden folder.

    (Note: Finder remembers your previously typed folders.)

What other methods do you use to hide a folder, a file or a drive?


MakeUseOf Recommends

Will Mueller

Will Mueller is a computer nerd and geek that has been using computers for far too long. With such I have worked in a large amount of web development as well as programming.

The comments were closed because the article is more than 180 days old.

If you have any questions related to stuff mentioned in the article or need help with any computer issue, just ask it on MakeUseOf Answers.

Hide 33 Comments

  • mm June 28, 2008
    0 likes

    method one doesn’t work correctly, I can still see the hidden folders in windows explorer…but in the cmd it doesn’t appear

    | Like
    • Jason June 28, 2008
      0 likes

      Yeah, method one just marks it as a system file. All you have to do to see it is make Windows show “protected operating system files.”

      This is like hiding your pr0n mags by pasting them inside the cover of Better Homes and Gardens. Not Recommended.

      | Like
      • Rut November 10, 2009
        0 likes

        I am not computer savy at all, what is the raw bones easiest way for me to hide a file on my computer? It is very important that this particular file be hidden. Please make the explanation very 1,2,3 ish that I can impliment.Thanks, Rut

        | Like
    • subramanya teja March 10, 2009
      0 likes

      U can see them in command prompt also if use dir /a

      | Like
  • Ashwin CS June 28, 2008
    0 likes

    Method 4 can also be used to upload and share Mp3 and Video files using image hosting/sharing sites like flickr or Picasa, just copy the mp3 or video file using the above method and upload.

    | Like
    • death July 30, 2008
      0 likes

      u sly dog! good thinkin’

      | Like
  • James June 28, 2008
    0 likes

    If I ever want to hide something, I put the file in a password protected rar file and remove the file extension. Throw in a random name and bury it in the system files and it is good for most things.

    | Like
  • Mackenzie June 28, 2008
    0 likes

    The dot is not a Mac thing. That is an old, old UNIX convention. We Linux users do that too. We’re not dumb enough to think it’s actually securely hidden, though, because ls -a always tells otherwise.

    | Like
    • makka February 5, 2009
      0 likes

      Yes, but if you name it something simple yet scary (ls -a is pretty well known among 7-year-olds in my community) like “.hard-drive-encryptor” or “.osx-base-code” and put it in the Hard Drive itself rather than your Home folder, it’s not as obvious. Also, if you put several dummy folders like that with several more dummies in there, most people will just give up.

      | Like
  • Nik July 1, 2008
    0 likes

    Is there a free windows program that will password protect folders?

    | Like
  • death July 30, 2008
    0 likes

    if you want 2 get a little more difficult you could use method for a different way.

    instead of going the easy route and making a new folder in drive c just figure out how 2 find a folder you all ready have

    type this into cmd to find say the Documents folder

    cd\
    cd users
    cd owner
    cd documents

    and u’ll get a command line that looks something like this
    C:\Users\Owner\Documents\>

    im pretty sure it’l work on other computers but this is just the way i went about figuring it out!
    happy testing and never stop learning

    in case ure wondering it took me all of maybe 2 minutes to figure this out! lol

    | Like
  • Comment... they never stop September 11, 2008
    0 likes

    Thank u :D

    (used nr.2)

    | Like
  • Bro' September 11, 2008
    0 likes

    You can also disguise wav’s and img’s by changing the (dot)something to any other format.

    | Like
  • Rahul sharma December 29, 2008
    0 likes

    these methods are good…but i think its better to download programs to hide files

    | Like
  • P January 2, 2009
    0 likes

    I’ve always thought the extension trick works best :P

    though…. there are some programs a tech savvy person could use to find what it originally ran with.

    | Like
  • Bruno January 22, 2009
    0 likes

    HI everyone! Here is a simple script to manage your folder security.

    IT has the following FEATURES:
    - LOCK a Folder / LOCK a Folder and hide it.
    - UNLOCK a Folder
    - UNHIDE a Folder / UNHIDE a folder and UNLOCK it.
    - You can lock/unlock a folder of your choice. Just type in the folder name.
    - You can UNHIDE a hidden folder of your choice, but you need to know the name of the folder you are going to UNHIDE.
    - MENU

    Just copy and paste the code below in notepad and save it as filename.bat and then run it. That’s it!

    You’re free to copy and modify the code and sell it if you want.
    - BRUNO
    ===========================================

    @ECHO OFF
    title LOCKA FOLDA
    :MENU
    echo **LOCKA FOLDA MENU**
    echo L - Lock a folder
    echo U - Unlock a folder
    echo H - Unhide a hidden folder (Make sure you know the folder name)
    echo A - About this program
    echo X - Exit
    echo Enter your choice:
    set/p “chois=>”
    if %chois%==L goto BEGINLOCK
    if %chois%==l goto BEGINLOCK
    if %chois%==U goto UNLOCKF
    if %chois%==u goto UNLOCKF
    if %chois%==H goto BEGINUNHIDE
    if %chois%==h goto BEGINUNHIDE
    if %chois%==A goto ABOUT
    if %chois%==a goto ABOUT
    if %chois%==X goto END
    if %chois%==x goto END
    :UNLOCKF
    cls
    echo Please enter the folder you want to UNLOCK:
    set/p “lockfldr=>”
    :UNLOCKF2
    if EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNLOCK
    if NOT EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNLOCKNOTFOUND
    :BEGINLOCK
    cls
    echo Please enter the folder you want to LOCK:
    set/p “fldr=>”
    if EXIST %fldr% goto LOCK
    if NOT EXIST %fldr% goto LOCKNOTFOUND
    :BEGINUNHIDE
    cls
    echo Please enter the folder you want to UNHIDE:
    set/p “lockfldr=>”
    if EXIST %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” goto UNHIDE
    if NOT EXIST %lockfldr% goto END
    :LOCK
    ren %fldr% %fldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
    goto DONELOCK
    :UNLOCK
    ren %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}” %lockfldr%
    goto DONEUNLOCK
    :DONELOCK
    echo %fldr% has been successfully locked!
    echo Would you like to hide this folder?[y/n] :
    set/p “chide=>”
    if %chide%==Y goto HIDE
    if %chide%==y goto HIDE
    if %chide%==N goto DONELOCK2
    if %chide%==n goto DONELOCK2
    :DONELOCK2
    echo Would you like to lock another folder?[y/n] :
    set/p “dlock=>”
    if %dlock%==Y goto BEGINLOCK
    if %dlock%==y goto BEGINLOCK
    if %dlock%==N goto MENU
    if %dlock%==n goto MENU
    :DONEUNLOCK
    echo %lockfldr% has been successfully unlocked!
    echo Would you like to unlock another folder?[y/n] :
    set/p “dlock=>”
    if %dlock%==Y goto UNLOCKF
    if %dlock%==y goto UNLOCKF
    if %dlock%==N goto MENU
    if %dlock%==n goto MENU
    :UNLOCKNOTFOUND
    echo %lockfldr% Folder not found!
    echo Would you like to try again?[y/n] :
    set/p “unotf=>”
    if %unotf%==Y goto UNLOCKF
    if %unotf%==y goto UNLOCKF
    if %unotf%==N goto MENU
    if %unotf%==n goto MENU
    :LOCKNOTFOUND
    echo %fldr% Folder not found!
    echo Would you like to try again?[y/n] :
    set/p “notf=>”
    if %notf%==Y goto BEGINLOCK
    if %notf%==y goto BEGINLOCK
    if %notf%==N goto MENU
    if %notf%==n goto MENU
    :AFTERUNHIDE
    echo Would you like to UNLOCK this folder?[y/n] :
    set/p “afthide=>”
    if %afthide%==Y goto UNLOCKF2
    if %afthide%==y goto UNLOCKF2
    if %afthide%==N goto MENU
    if %afthide%==n goto MENU
    :HIDE
    attrib +h +s %fldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
    echo %fldr% is now hidden! Please take note of the folder name because you will need it to unhide the folder.
    goto DONELOCK2
    :UNHIDE
    attrib -h -s %lockfldr%”.{ECF03A32-103D-11d2-854D-006008059367}”
    echo %lockfldr% is now visible!
    goto AFTERUNHIDE
    :ABOUT
    echo +—————–+
    echo ¦ LOCKA FOLDA ¦
    echo +—————–+
    goto MENU
    :END


    ================================================
    MABUHAY PINOY!

    | Like
    • subramanya teja March 10, 2009
      0 likes

      It’s not working for me…. It’s giving a message goto was unexpected at this time as soon as i select any choice

      | Like
    • Treeza June 23, 2009
      0 likes

      hey i have make a batch file but when i run it ..it asks for the option . i hv just entered option but it not works..how it works?where we should give the name of folder which we want to lock?

      | Like
    • Guru July 16, 2009
      0 likes

      Hello Bruno,
      This is Guru from India pune.
      Regarding Folder Lock by script.
      i’am trying to lock folder by your script to manage folder security, and iam creating Bat file but when i run this script then it will open and giving opposition for ” Enter your choice ” and when’s i chose opposition and Enter then script closed automatically. What should i do?
      pls can u help me on this.

      Regards,
      Guru
      +91 9890147466

      | Like
  • sagayaprabhu February 14, 2009
    0 likes

    very nice its very use full to so that we can save the folder as our security so that we can save any type files in that folder

    | Like
  • Binod April 12, 2009
    0 likes

    Good Tips. I am very happy and satisfied with the tip. Have added to my blog too! Thanks guys.

    | Like
    • rob October 18, 2009
      0 likes

      Can any one please tel me what is the folder name i need to selact

      | Like
  • Binod April 12, 2009
    0 likes

    Very useful script. I like it. have added in my blog too.

    | Like
  • ranim May 9, 2009
    0 likes

    ay , i have the same prob, i ve done the install i run it and its working but when i shoose any of the choices nothing happen….i am intrested to know how dis lock will works

    thanks

    | Like
  • farooq July 8, 2009
    0 likes

    thanks man…….it works….. thumbs up for ya…….:)

    | Like
  • Guru July 9, 2009
    0 likes

    realy it’s helpfull.

    Thanks

    | Like
  • Guru July 9, 2009
    0 likes

    Thanku very much

    | Like
    • naveed July 22, 2009
      0 likes

      If somebody deletes the lock.bat $ key.bat files in the method 3 . I think its better to use a software.

      | Like
  • rob October 18, 2009
    0 likes

    soory, it did not work can you please tell me what is the folder name i need???

    | Like
  • Folder Guard October 19, 2009
    0 likes

    Method 6: save yourself the trouble and get software specifically designed to do the job, such as our Folder Guard.

    | Like
  • tom November 8, 2009
    0 likes

    Gili File Lock pro is a power file encryption software program that can quickly and safely lock and hide files, folder,and drives,and it can use 256-bit AES encryption (Encryption Standard Adopted by the US Government) to protect your files located on HDD drive or any portable media such as USB drives.

    | Like
  • George January 2, 2010
    0 likes

    Why so mus\ch fuzz – use winzip to zip the files (all files in a folder)with a password – works on all OS

    | Like