Skip to content Skip to sidebar Skip to footer

Writing to a Read Only Folder With .bat

Download Commodity

Download Article

Practise you have items you desire to keep subconscious on your computer? Creating a locked folder using a batch script is a fun and easy mode to hide files in low-stakes situations that don't require files to be encrypted. This wikiHow teaches you how to create a locker folder using a batch file.

Steps Download Article

  1. 1

    Open up Notepad. Notepad has an icon that resembles a blue notebook folder. Use the post-obit steps to open Notepad:

    • Click the Windows Start Menu.
    • Type "Notepad."
    • Click Notepad.
  2. two

    Re-create the post-obit batch script. The batch script is in the box below. Highlight the entire script. Correct-click it and click Copy, or press "Ctrl + C." The script is as follows:[1]

                                                cls                      @                      ECHO                      OFF                      title                      Folder Locker                      if                      Exist                      "Command Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"                      goto                      UNLOCK                      if                      NOT                      EXIST                      Locker                      goto                      MDLOCKER                      :                      CONFIRM                      repeat                      Are you lot sure u desire to Lock the binder(Y/N)                      set/p                      "cho=>"                      if                      %cho%                      ==Y                      goto                      LOCK                      if                      %cho%                      ==y                      goto                      LOCK                      if                      %cho%                      ==n                      goto                      END                      if                      %cho%                      ==Due north                      goto                      END                      repeat                      Invalid option.                      goto                      Ostend                      :                      LOCK                      ren                      Locker                      "Command Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"                      attrib +h +s                      "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"                      echo                      Folder locked                      goto                      End                      :                      UNLOCK                      repeat                      Enter password to Unlock binder                      set/p                      "pass=>"                      if                      NOT                      %pass%                      ==TYPE_YOUR_PASSWORD_HERE                      goto                      Fail                      attrib -h -southward                      "Control Console.{21EC2020-3AEA-1069-A2DD-08002B30309D}"                      ren                      "Command Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"                      Locker                      echo                      Binder Unlocked successfully                      goto                      End                      :                      Fail                      echo                      Invalid password                      goto                      end                      :                      MDLOCKER                      md                      Locker                      repeat                      Locker created successfully                      goto                      Terminate                      :                      Cease                    

    Advertizing

  3. 3

    Paste the code into Notepad. Become dorsum to your blank Notepad document. Right-click at the top of the page and click Paste, or press "Ctrl + Five" to paste the code into Notepad.

  4. 4

    Alter the password. Locate where it says "TYPE_YOUR_PASSWORD_HERE" in the script. Information technology's about three-quarters of the way downwardly. It's in the line that starts with "if Not %pass%==".

  5. five

    Save the document as a batch file. Utilize the following steps to salvage the Notepad document as a batch file:

    • Click File.
    • Click Save equally.
    • Click the drib-down carte next to "Relieve as type."
    • Select All files (*.*).
    • Blazon a file name in the File Name field (i.e. LockedFolder).
    • Type ".bat" at the end of the file proper name (I.e. LockedFolder.bat).
    • Click Relieve.
  6. 6

    Close the window. In one case you are finished saving the Batch file, you can close Notepad.

  7. 7

    Run the batch file by double-clicking it. Navigate to where y'all saved the batch file in File Explorer. Double-click the batch file to run it. This will create a new binder chosen "Locker" in the same folder as the batch file.

  8. 8

    Movement all the things you want to hide into the Locker folder. Yous can move objects into the folder by dragging and dropping them, or you can copy and paste them into the folder.

  9. ix

    Double-click on the locker.bat file again. A Command Prompt will open up. It volition ask you if yous want to lock the folder.

  10. 10

    Press Y and then press Enter . The Locker folder will disappear from the folder. This indicates it is locked.

  11. 11

    Unlock the binder. When yous want to gain access to the folder over again, use the post-obit steps to brand the Locker binder reappear:

    • Double-click the batch file to run it.
    • Enter the password y'all input into the batch file before y'all saved it.
    • Press the Enter key.

    Advertisement

Add New Question

  • Question

    How do I re-lock the file?

    Community Answer

    Double-click the file once more. It will enquire for a password. Enter the countersign, and you're done!

  • Question

    How practice I reset the password?

    Community Answer

    Right-click on the .bat file. After doing then, click 'edit.' Y'all tin change the code through this.

  • Question

    My folder will not re-lock when typing Y. What do I do?

    Community Answer

    Are you sure you're typing everything correctly? What Windows version are yous using?

  • Question

    Could an unauthorized person right click on locker.bat and edit the password?

    Community Answer

    Yes. They can edit the countersign easily as long equally they know the batch programming linguistic communication.

  • Question

    How exercise I remove a batch file if I locked a binder?

    Community Answer

    If the binder is arrangement, use the attrib -southward /f1/folder command to delete the system attribute.

  • Question

    How do I copy the code from a batch file?

    Community Answer

    Right click and press Edit in the carte and in Notepad, Right click and click Select All and so Right click again and so Copy this time.

  • Question

    How practise I automatically lock the batch file?

    Community Answer

    Yous can't lock the batch file. But you tin can make it read-only via its backdrop.

  • Question

    How exercise I create an application with no software?

    Community Answer

    You can't, the software is what you employ to write the code, You can utilize CMD as a more directly fashion, but CMD is nevertheless software.

  • Question

    How practice I go rid of a "private.bat" file I created? I've tryed to Delete from the folder I saved it in but the file keeps re-installing itself every time I apply my Photos App.

    CageyCat

    It could be that "Photos" uses a file of that name. Try this. Write downwards the name of the folder where the file sits now. Re-create "private.bat" to a new folder on a pollex bulldoze. So, correct click and select rename, such as "private_old.bat". Attempt opening "Photos" App and encounter if that program remakes a "private.bat" file. Whether information technology does or not, you lot should exist safest to copy the _old version to the same binder on that thumb bulldoze-- just in case.

Ask a Question

200 characters left

Include your email address to become a message when this question is answered.

Submit

Advertisement

Video

  • Set the batch file attribute to "hidden" so it will not show up in a standard File Explorer window. You will need to set up File Explorer to show hidden files and folders to view the batch file.

  • For a more than robust method of password protecting folders, attempt using Axcrypt, Windows Bitlocker. Bitlocker is available on Windows x Pro, Enterprise, and Education editions. Axcrypt is a third-party encryption program that works on all versions of Windows.

Advertisement

  • Programs like 7zip File Manager will exist able to access the folder.

  • Practice not rename the file after it is secured. Information technology will no longer be protected.

  • Windows Search could observe it the hidden binder.

  • Exist enlightened that anyone who can access the batch file tin edit it in Notepad and discover out the password.

Advertisement

Most This Article

Thanks to all authors for creating a page that has been read 268,230 times.

Is this article up to appointment?

jacobsfalas1972.blogspot.com

Source: https://www.wikihow.com/Lock-a-Folder-Using-a-Batch-File

Post a Comment for "Writing to a Read Only Folder With .bat"