|
![]() |
| Double Zip With Password |
You don't need to bother with this if you are uploading to the files area of the the MAKEMSI group but to ensure that the attachment makes it through any spam or virus filters (I can think of 3 different sets it has to get though now...), I highly recommend that you send attachments using this (well tested) approach:
This step ensures that it is not possible for automated processes (which don't know the password) from looking inside the zip (as both the contents and "contents listing" becomes hidden).
A virus program may complain if it sees a ".vbs" extension in a file list even if it can't open it to see if its safe.
To simplify the whole process I have created this batch file ("ZipPw.cmd" which uses the info zip file named renamed to izip.exe):
@echo off
echo []-----------------------------------------------------------------[]
echo ^| Protect ZIP inside Password protected ZIP wrapper, version 11.200 ^|
echo []-----------------------------------------------------------------[]
echo.
echo INSTRUCTIONS
echo ~~~~~~~~~~~~
echo 1. Create ZIP file that you wish to email/protect
echo 2. Use this batch file to create a password protected wrapper
echo 3. Email the zip (or txt) file this batch file created.
echo.
echo.
setlocal ENABLEEXTENSIONS
set ProtectThis=%~1
set Pw=%~2
set WantTxt=%~3
set DefaultPw=safe
set DefaultWantTxt=Y
if "%PW%" == "" set Pw=%DefaultPw%
if "%WantTxt%" == "" set WantTxt=%DefaultWantTxt%
if "%ProtectThis:-=/%" == "/?" goto ShowSyntax
if "%ProtectThis:-=/%" == "/h" goto ShowSyntax
if not "%ProtectThis%" == "" set Interactive=N& goto HaveP1
set Interactive=Y
set /P ProtectThis=Protect What File (drag+drop file or BLANK=QUIT)? ==^> &rem
if "%ProtectThis%" == "" goto :EOF
set /P PW=What Password (BLANK=%DefaultPw%)? ==^> &rem
if "%PW%" == "" set Pw=%DefaultPw%
:AskTxtAgain
set /P PW=Want to rename to ".z.i.p.txt" (Y/N, BLANK=%DefaultWantTxt%)? ==^> &rem
if "%WantTxt%" == "" set WantTxt=%DefaultWantTxt%
if /I "%WantTxt%" == "N" goto :AllGood
if /I "%WantTxt%" == "Y" goto :AllGood
goto AskTxtAgain
:HaveP1
:AllGood
for %%f in ("%ProtectThis%") do set SrcPath=%%~df%%~pf
for %%f in ("%ProtectThis%") do set ZipFileNE=%%~nf%%~xf
set Right4Chars=%ZipFileNE:~-4%
if /I "%Right4Chars%" == ".ZIP" set ZipFileNE=%ZipFileNE:~0,-4%
cd /d "%SrcPath%"
set ZipFile=%ZipFileNE%.zip
set ZipFilePw=PASSWORD=%Pw%, %ZipFileNE%.zip
if exist "%ZipFile%" goto ZIP_FOUND
echo ERROR: Could not find the ZIP file "%ZipFile%"!
goto Finished
:ZIP_FOUND
cls
echo MAKING: %ZipFilePw%
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
del "%ZipFilePw%" >nul 2>&1
echo Its PASSWORD is '%Pw%' | izip.exe -P "%Pw%" -z -0 "%ZipFilePw%" "%ZipFile%"
echo.
echo.
del "zia*" >nul 2>&1
if exist "%ZipFilePw%" echo CREATED: "%ZipFilePw%"
if /I "%WantTxt%" == "N" goto Finished
echo Will rename the zip file...
set TxtName=Zip%ZipFilePw:.zip=.[z.i.p].txt%
del "%TxtName%" > nul 2>&1
ren "%ZipFilePw%" "%TxtName%"
if exist "%TxtName%" echo CREATED: "%TxtName%"
:Finished
if "%Interactive%" == "Y" pause
goto :EOF
@rem +++++++++++++++++
:ShowSyntax
@rem +++++++++++++++++
echo CORRECT SYNTAX
echo ~~~~~~~~~~~~~~
echo ZipPW[.cmd] [PathToZip\]NameOfZip[.zip] [AlternativePassword]
echo.
echo Takes 1-3 parameters as follows:
echo.
echo 1: Name of zip file to be protected (with or without ".zip" extension)
echo 2. The password to be used ("%DefaultPw%" is the default)
echo 3. Want to rename result to ".z.i.p.txt" ("%DefaultWantTxt%" is the default)
goto :EOF
![]() | ![]() |