Batch to compress directory with password

Dear All,

  • C:\myfiles\001 (There are 001.txt / 002.txt inside)
  • C:\myfiles\002 (There are 003.txt / 004.txt inside)

I would like to make a batch to compress directory with password.

for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" -p12345aBc -mhe "%%X\"

With upper command,

001.7z and 002.7z are created.

But 001.txt and 002.txt are under folder 001 of 001.7z

001.7z
└─ 001
   ├─ 001.txt
   └─ 002.txt

002.7z
└─ 002
   ├─ 003.txt
   └─ 004.txt

I would like to

  1. compress file without parent folder

001.7z
└─ 001.txt
└─ 002.txt

002.7z
└─ 003.txt
└─ 004.txt
  1. If password is required, "zip" is not supported ?

Thanks