Friday, April 5, 2013

Menjalankan Winrar dengan Command Line Window


This section provides a tutorial example on how to run WinRAR in a command line window.
   

WinRAR also support command line operations. This is important to allow users to incorporate WinRAR commands into automated scripts. Here is a simple script I used to backup a directory, backup.bat:

@rem backup.bat
@rem Usage: backup directory zipfile password

\local\winrar\winrar a -afzip -r -p%3 %2.zip %1\*.*

My restore script is also very simple, restore.bat:

@rem restore.bat
@rem Usage: restore zipfile password

\local\winrar\winrar x -p%2 %1.zip .\

Note that:

    Command "a" is to create archive files.
    Option "-afzip" is to create archive files in ZIP format.
    Option "-r" is to take input files recursively to include sub-directories.
    Option "-p*" is to add password protection to archive files.
    Command "x" is to extract files out of archive files.

For complete description of the command line interface of WinRAR, see the WinRAR help document.

Source : © 2008 by Dr. Herong Yang.
All rights reserved.

No comments:

Post a Comment