Search code examples
batch-filewinrar

Batch files by winrar


I want to archive files in a folder by winrar.

I only can archive one file using rar a -p0000 C:\backup\ C:\backup\test.txt

How can I archive files in a folder ?


Solution

  • Try:

    rar a -p0000 C:\backup\ C:\backup\*
    

    If rar.exe does not accept that then (firstly its crap, and you should GET RID OF IT) and secondly you can use:

    pushd "C:\backup\"
    for /r %%a in (*) do (
    rar a -p0000 C:\backup\ C:\backup\%%a
    )
    popd
    

    And that should work just as fine. If thats not what your looking for or that doesn't work, please say so.

    Mona