Question : Using WinRAR on the command line

I need to use WinRAR to archive a folder, but I need to specify some options and I need to have it run via a batch script. The folder I am archiving is called Testing123 and it is located on the C:\

I have to specify specific options:
1. Compression method: Best
2. Archiving options: Delete Files after archiving, Create SFX archive, Create Solid archive, Put authenticity verification, and Lock Archive.
3. Under SFX Options: Path to extract <path>
4. Silent Mode: Hide Start dialog
5. Overwrite mode: Overwrite all files

I have started a batch, but I think my switches are off.
@setlocal
@Echo off
CLS

C:

cd "\Program Files\WinRAR\"

RAR a Testing123.rar -av -df -s2 -sfx -k "C:\Documents and Settings\ea17970\Desktop\Test RAR\Testing123.rar"
Pause

Any help would be much appreciated:

Thank you

Answer : Using WinRAR on the command line

==> The -df is deleting the files after acrhiving, but it is not deleting the folder that the files live in.  

I think that is true.  I believe there is a command called M (rather than A you are using) that moves files to the archive and may delete the folders too, but I haven't worked with that so you will have to experiment.  More info in the help file on that.

==> I also need to add overwrite existing files which I believe is o+?

Yes, that is -o+ switch.

==> If I wanted to add archive comment would that be c or -c ?

It looks like you either do that in a separate RAR command with a C, or can do it with the current A command using the -z<file> switch, more info in the Help file on that.

~bp
Random Solutions  
 
programming4us programming4us