I have 300 Microsoft Word files sitting in 300 folders.

I want to password protect these files with a single password in one go.

My understanding is that the easiest way to accomplish this would be to put each of these files in an archive.

I know that WinRAR has an option to put each file to separate archive, which would have been perfect if it saved these files in the same folder where the original file comes from.

How can I get this done?

I'm getting a list of the files (I'm using Everything search, but I'm sure the same can be accomplished using a regular windows file search), then right-clicking and selecting Add to Archive using WinRAR's context menu.

I'm happy to drag-and-drop these files somewhere.

But I need to preserve the directory structure of where the original files used to be.

  • Why not Zip, RAR a or otherwise archive the whole directory tree? E.G. using 7-Zip, right-click the folder, select the "Add to archive" option, and set a password for the archive. – DrMoishe Pippik Dec 4 '15 at 1:23
  • because these files are just 1% of the rest of the file structure in these folders. I need to password protect these files so I can share the parent folder – Uno Mein Ame Dec 4 '15 at 3:21

you'll need WinRAR Installed

  1. Open Notepad and paste the following:
@echo off
for %%F in (%*) do (
CD %%~dpF
"C:\ProgramFiles\WinRAR\rar.exe" a -m0 -hpThisIsThePassword "%%~nF.rar" "%%~nxF"
  1. Customize the script (optional)

read WinRAR.chm (in your WinRAR folder) and make sure you understand the command line switches needed.

  • "C:\ProgramFiles\WinRAR\rar.exe": Path to rar.exe
  • a : adds file to a .rar archive
  • -m0 : stores files without compression (faster)
  • -hpThisIsThePassword : sets password to "ThisIsThePassword", Don't edit the "-hp" just add your password after it, replacing "ThisIsThePassword".
  • "%%~nF.rar" : .rar Archive name, I set it to the same name of the archived file, Edit if you absolutely know what you're doing. otherwise leave it as it is.
  • you can add -df to delete files after archiving USE WITH CAUTION
  1. Save the text as a Batch file with .bat extention. and exit notepad
  2. Execute the script:
  3. OPTION 1: Drag and drop your Files (from search or whatever) and drop them on the batch file you just created.
  4. OPTION 2: put the batch file in sendto folder and right click on your files > Send To > YourBatfile.bat


  • the batch will add each file to a separate rar archive and save it in the same folder with the same name.
  • batches have a limit for parameters, so you may have to do them in a groups of ~100 files at time
  • you can access your sendto folder by typing "Shell:SendTo" in your file explorer address bar.

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.