Convert RAR, CAB, ISO, etc To ZIP

Recently I ran into a situation where I needed to convert some relatively obscure archive files (e.g. RAR) to the ZIP format. That’s easy enough if you only need to deal with a single file – just extract it using your favorite archiver and re-compress the extracted files as .zip.

However, manually converting dozens of files would take forever, not to mention how excrutiatingly tiresome it would be. So I wrote a Windows batch file that can convert any number of archives to ZIP using the open-source archiver 7-Zip. I’m posting the converter here in case anyone finds it useful.

Features

  • Converts (almost) any archive format to ZIP.
  • Supports wildcards.
  • You can set the output directory for the converted files. By default they’re created in the current directory.
  • Compatible with Windows XP and up.
  • Supported filetypes* : 7z, GZIP, BZIP2, TAR, ARJ, CAB, CHM, CPIO, DEB, DMG, HFS, ISO, LZH, LZMA, MSI, NSIS, RAR, RPM, UDF, WIM, XAR and Z.

* I didn’t actually test all of these formats, but most should work.

Download

zipconv.bat (2 KB)

Standard disclaimers apply. The software is provided as-is, don’t blame me if it kills your system, and so on. Also, don’t forget to download and install 7-Zip before using the batch file.

Usage

The converter should be run from the command line. If you’re not familiar with using the command prompt you can find some basic tutorials here.

General syntax
zipconv {input_filename} [output_directory]

The batch file takes up to two command line arguments. The first argument must be the name of the file to be converted. For example, this could be “oldarchive.arj” or “c:\backup\oldarchive.arj” if the file is not in the current directory. You can also use wildcards to convert multiple files in one go.

The second argument specifies the directory where to put the converted files. Setting it is optional – the converter will use the current directory by default. If you do set the output directory, don’t forget to include the final backslash in the directory name or the converter will make a mess.

Examples

  • Convert “somefile.rar” that is located in the current directory to “somefile.zip” :
    zipconv somefile.rar
  • Convert all CAB files from the current directory to ZIP :
    zipconv *.cab
  • Convert all RAR files to ZIP and put the converted files in a subdirectory “converted_files” (this directory wil be created if it doesn’t exist) :
    zipconv *.rar ".\converted_files\"

Good luck ๐Ÿ™‚

Related posts :

14 Responses to “Convert RAR, CAB, ISO, etc To ZIP”

  1. ML says:

    Thank you so very much for this. It has saved me a considerable amount of time from a very tedious file by file conversion.

  2. bobby says:

    RAR is an OBSCURE archive format?

  3. White Shadow says:

    Okay, it depends on how tech-savvy you are ๐Ÿ™‚ I think the average user would find it rather obscure (and I have search stats – people looking for ways to open .rar files – to back it up).

  4. sandy says:

    how to convert rar file 2 vedio file

  5. White Shadow says:

    You don’t really need to “convert” it – a .rar file is an archive like .zip. So you need to extract the file. See this page for details : free rar extractors.

  6. ALMOST610 says:

    I dont know why people are complaining about the RAR format its great the only thing i want to do is find a quick way to convert it to ZIP for my friends who download files and dont have an RAR extractor i told them to download one but they wont so i convert them to ZIP and transfer it to them!!!!!

  7. sophia says:

    thanks for the converter…it helped a lot…:)

  8. flamea says:

    this script helped me so much ๐Ÿ™‚
    thanks a lot ๐Ÿ˜€

  9. NeoDement says:

    yo thanks

    you’re my hero

  10. dieferman says:

    THANKS !
    …. But There’s A Problem Detecting 7zip In A x64 Windows OS So Here Is The Necessary Mod

    @echo off
    echo Zip Converter (c) 2009 W-Shadow, http://w-shadow.com/
    echo 2011 – Mod By DIEFER To Be Used On 64 Bit Windows OS
    setlocal

    rem ==============================================
    rem Find the 7z executable
    rem ==============================================
    rem Check the most likely 7-Zip installation path
    if exist “C:\Program Files\7-Zip\7z.exe” (set archiver=”C:\Program Files\7-Zip\7z.exe”) else (goto :detect64bit)
    goto :startprocessing

    :detect64bit
    if exist “C:\Program Files (x86)\7-Zip\7z.exe” (set archiver=”C:\Program Files (x86)\7-Zip\7z.exe”) else (goto :detect7z)
    goto :startprocessing

    :detect7z
    rem See if 7z is directly accessible
    7z.exe > nul
    if %errorlevel% == 0 (set archiver=”7z.exe”) else (goto :no7zip)

    :startprocessing
    rem Is the input pattern set?
    if “%1″==”” goto :nopattern
    rem Is the output folder set? (optional – by default, the current directory is used)
    if not “%2″==”” (set outdir=”%~dp2″) else (set outdir=”.\”)

    rem ==============================================
    rem Convert files
    rem ==============================================
    rem Loop over all files matching the input pattern
    for %%f in (%1) do (
    echo.
    echo ======================================================
    echo Converting file %%~nxf…
    echo ======================================================
    rem Extract the archive to a temporary folder
    %archiver% x “%%f” -y -o”%temp%\%%~nf.tmp”
    rem Compress the folder’s contents to zip
    %archiver% a “%outdir%%%~nf.zip” -mx7 “%temp%\%%~nf.tmp\*”
    rem Remove the temporary folder
    rd /s /q “%temp%\%%~nf.tmp”
    )

    goto :end

    :nopattern
    echo Convert most archives to the ZIP format using 7-Zip ( http://www.7-zip.org/ )
    echo.
    echo Syntax : %~n0 {input_pattern} [output_directory]
    echo Examples :
    echo %~n0 file.cab
    echo %~n0 *.rar
    echo %~n0 *.iso “d:\temp\”
    goto :end

    :no7zip
    echo Error : 7-Zip not found!
    echo Please install 7-Zip (www.7-zip.org) and add it’s directory to the PATH environment variable.

    :end
    endlocal

  11. Thanks, I added your modifications to the file.

  12. Jason Leonard says:

    Wow, that was MUCH FASTER than the system PeaZip uses…and being command-line I don’t get asked any questions. Putting the bat file in my path, I can really breeze through the conversions I need to do now. Very well thought out script to handle all versions of 7-Zip, too.

  13. Mze says:

    Nice work. Worked well for me. Many thanks.

  14. David says:

    Thank you for you effort, great help ๐Ÿ™‚

Leave a Reply