• Around The HomeToggle Menu

    • Entertainment
    • Productivity
    • Smart Home
  • FamilyToggle Menu

    • Parenting
    • Toys
    • Pets
    • Travel
  • Product ReviewsToggle Menu

    • Phones
    • Tablets
    • Laptops
    • Desktops
    • Wearables
    • Audio
    • Cameras
    • Headphones
    • Printers
    • Smart Home
    • TVs
    • Gaming and Video
  • One Cool ThingToggle Menu

    • Frugal Tech
    • Kickstarters
    • Videos
Techwalla
  1. Home
  2. Around The Home
  3. Productivity
  4. How to Give a Password to a File or Folder in CMD without Using Any So...

How to Give a Password to a File or Folder in CMD without Using Any Software

March 31, 2015
By: JeffreyC
  • Share
  • Share on Facebook

There may be things on a computer that are sensitive that people should not see. Most people can find things just by snooping around if they have general knowledge of computers. Having a password-protected folder will work wonders against people and keep documents and files safe from prying eyes.

Video of the Day

Locking a Folder

Step

Open up notepad and paste the following code into it.

ls @ECHO OFF echo // Check1 (In Main Function) title Folder LockFolder if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLockFolder if NOT EXIST LockFolder goto MDLockFolder :AuthConfirm echo Are you sure u want to Lock Folder (Y/N) set/p "cho=>" if %cho%==Y goto LockFolder if %cho%==y goto LockFolder if %cho%==n goto END if %cho%==N goto END echo Invalid choice. goto AuthConfirm :LockFolder ren LockFolder "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" echo Folder LockFolder Locked! goto End :UNLockFolder echo Enter password to Unlock Folder set/p "pass=>" if NOT %pass%==TYPE YOUR PASSWORD HERE goto FailUnlock attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" LockFolder echo Folder UnLocked successfully! goto End :FailUnlock echo Invalid password! echo Try again? (Y/N) set/p "choice=>" if %choice%==Y goto UNLockFolder if %choice%==y goto UNLockFolder if %choice%==N goto END if %choice%==n goto END :MDLockFolder echo // Check2 (In MD Dir Function) md LockFolder echo Folder LockFolder created successfully! goto End :End

Put the password where it says "TYPE YOUR PASSWORD HERE."

Step

Save the file as locker.bat by clicking "File," "Save As," and at the bottom, where it says .txt, change to "All Files."

Step

Open locker.bat and enter your password. It will create a new folder that will be password-protected from now on.

Show Comments

Related Articles

How to Lock & Unlock an Excel Spreadsheet

How to Lock & Unlock an Excel Spreadsheet

Around The Home
Productivity
By: David Weedmark
How to Write Protect a PDF

How to Write Protect a PDF

Around The Home
Productivity
By: Andrew Tennyson
How to Set Up a Job to Automatically Zip Files in a Folder Based on a Scheduled Task

How to Set Up a Job to Automatically Zip Files in a Folder Based on a Scheduled Task

Around The Home
Productivity
By: Ken Burnside
How to Unlock an Excel Workbook

How to Unlock an Excel Workbook

Around The Home
Productivity
By: Foye Robinson
How to Find My WEP or WPA

How to Find My WEP or WPA

Around The Home
Productivity
By: Laura Catella
How to Detect Hidden Cameras & Listening Devices

How to Detect Hidden Cameras & Listening Devices

Around The Home
Entertainment
By: Brian Richards
  • HOW WE SCORE
  • ABOUT US
  • CONTACT US
  • TERMS
  • PRIVACY POLICY
  • COPYRIGHT POLICY
  • Advertise

An error occurred. Try again later.

Thanks for signing up!
© 2018 Leaf Group Ltd. Leaf Group Media

Get great tech advice delivered to your inbox.

Keep your family productive, connected, entertained, and safe.

Please enter a valid email.