MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Email Attachments[Next]: Disclaimer
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Feedback and Support->Email Attachments->Double Zip With Password

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:

  1. Create a zip file containing the contents you wish to send.

  2. Zip up the zip you created above (so you have a zip file inside a zip file).

  3. Put a password (to encrypt) on the zipped up zip. Be sure to tell me what the password is ("makemsi" recommended)!

    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.

  4. Looks like gmail needs an extra step which is to rename the ".zip" to ".txt".

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


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Email Attachments[Next]: Disclaimer


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday August 13 2017 at 2:39pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.