Command Line Winrar & Batch Scripts

28,367

Solution 1

if you want to suppress the output just add > null at the end of command line for rar.exe.

I use 7-zip's command line tool and I am pretty happy with it. its just a single exe.

http://dotnetperls.com/7-zip-examples

Solution 2

(first of all, sorry for my horroble english)

Thanks for this very useful script!!!

About that messages, in the version 3.42 the winrar there is a param call inul that you can use to turn off all message. Using your example

"C:\Program Files\WinRar\rar.exe" a -agyyyy-MM-dd -r -inul "C:\A...

This way you only see the echo statements.

Thanks again ;)

Regards Alejandro

Share:
28,367

Related videos on Youtube

Eoin Campbell
Author by

Eoin Campbell

Husband/Dad @ Home, Senior Technical Architect @ ChannelSight, Photographer & Gamer in my spare time. I keep an irregularly updated blog @ http://trycatch.me/

Updated on September 17, 2022

Comments

  • Eoin Campbell
    Eoin Campbell almost 2 years

    I've written a wee batch script to backup some stuff on my desktop and dump it over the network to a share... The only thing that's bugging me is the verbosity of rar.exe while it's doing the compress part of the job.

    Anyone know if it's possible to tweak rar.exe to display a status bar for the entire process of at least suppress the output of each individual file being added to the archive.

    Alternatively, if theres any other command line compression tools for windows (winzip/7zip) that people are familiar with, I'd be happy to use those either. Or any suggestions to make this batch job a little more robust.


    @echo off
    echo "Beginning Compress Job"
    
    "C:\Program Files\WinRar\rar.exe" a -agyyyy-MM-dd -r "C:\Archives\" "C:\Work\Folder1\" "C:\Work\Folder2\" "C:\Work\Folder3\" 
    
    echo "Files backed up to C:\Archives"
    
    NET USE U: > %TMP%\JunkerFile 2>&1
    IF %ERRORLEVEL% == 0 GOTO Success
    echo "Drive Disconnected - Cannot Copy Backup To U:\"
    GOTO End
    :Success
            echo "Drive Connected"
            echo "Performing Backup"
            move C:\Archives\*.rar U:\Archives\
            echo "Backup Complete"
            GOTO End
    :End
    
    pause