Question

How to Zip files using WINZIP via Run Program AC

  • 26 May 2023
  • 5 replies
  • 537 views

Badge +2

Hi

 

I would like to zip ABC.xlsx file from folder path T:\User\Kryon Output into folder path T:\User\Kryon Output.

 

What values should I set and which command line parameters should I use?

Regards,

 


5 replies

Userlevel 6
Badge +16

Hi @Shin 

  1. I’m using Winzip64 - Have you considered using 7Zip?
    Require to download the Winzip Command Line Add-on.
    C:\Program Files\WinZip\WZZIP.EXE
    This is the command line version of WinZip
  2. I’m using a Batch File (.BAT) )to drive the Zip Operation
    Place the batch file into the same directory as your Excel file
  3. The basic Winzip command Line is
    C:\Program Files\WinZip\WZZIP.EXE  <Compress Zip filename>  <file to compress>
    C:\Program Files\WinZip\WZZIP.EXE   files.zip   ABC.xlsx
  4. The content of the Batch File
    You need to update the Drive and Folder
    @ECHO OFF
    REM ##=================================
    REM ## DOS Script to Backup Files or Folder
    REM ## Require: Winzip
    REM ## Author: Garrett Fernandez
    REM ## Date : 26-Mar-2023
    REM ##=================================

    REM Switch to "D" Drive
    D:
    REM CD to Folder
    CD "D:\Demo"

    SET hr=%time:~0,2%
    IF %hr% lss 10 SET hr=0%hr:~1,1%

    Set TODAY=File_%date:~4,2%-%date:~7,2%-%date:~10,4%_%hr%%time:~3,2%
    REM ## Set Filename to "File_28-03-2023_1900.zip"

    ECHO Compressing Excel Files into...
    ECHO %TODAY%.zip

    ECHO.

    "C:\Program Files\WinZip\WZZIP.EXE" "%TODAY%.zip" "ABC.xlsx"
    ECHO.

    PAUSE
  5. You can just point to the Batch file in your folder from your RPA

 

Badge +2

Hi, I am not using 7zip. The zip app I am seeing is C:\Program Files (x86)\WinZip\WINZIP32.EXE.

May I check if there is alternative way other than using BAT file? I am not unsure what I should change in the BAT file to accommodate to my RPA.

Userlevel 6
Badge +16

Hi @Shin 

 

1.)  Have you tried to create a zip file (from the command line) using WinZip32?

Open a Command Prompt - Windows Terminal, PowerShell, Command
CD or switch to the Excel file folder. 
Compress the Excel file using the WinZip32
→ C:\Program Files (x86)\WinZip\WINZIP32.EXE  final.zip  ABC.xlsx

Working? Yes - wow!! Great!
No - You need to check which is the correct Command line executable or the correct syntax

 

2.)  Try from a script

Open a new Notepad file
Type in the command which work from above
→ C:\Program Files (x86)\WinZip\WINZIP32.EXE  final.zip  ABC.xlsx
Save the file with the BAT or CMD extension (not TXT) into the same folder
Try to run the Batch file (from the command line)
Try to run the Batch file (from Explorer → double-click file)

Working? Yes - wow!! Great!

 

3.) What you need to change

Line which start with “REM” are remark line which are ignore
Change the Drive Letter → “T:”
Change the Folder → “T:\User\Kryon Output”

Replace the command → C:\Program Files (x86)\WinZip\WINZIP32.EXE (if it works)

 

Hope that helps
 

Userlevel 1
Badge +6

Hello

See here: just use powershell (make sure to turn on powershell admin features on your computer)

 

Userlevel 5
Badge +20

Hi @Shin 

Have you found a solution for your question? 

Reply