2

I am trying to run a batch file to rar everything in a folder at password them, also I want a log to see something gone wrong.

the comamnd line is as follow

rar a -r0 -p%var% -ilog.\error.txt -xcode.txt -xrar.bat -xerror.txt -x*.rar "%CurrDirName% " -agDD-MM-YYYY 

%var% comes from a variable and its OK

The problem is -ilog switch doesn't trigger at all I also have tried

  • -ilog[C:\error.txt]

  • -ilogc:\error.txt

and others but it seems to not be working

I am running WinRAR 4.10 beta 1 and I can't update it.

Update: Ok after tests it seems that -ilog is triggered only if errors exist. In help the file says

-ilog[name]

you don't need the [], if you want the log file to be created in the folder you are running the bat file use, -ilog.\error.txt or whatever name you want

0

1 Answer 1

0

The switch -ilog writes only errors to the specified log file as it is described by the help of WinRAR. The file is not created at all if no error occurred on WinRAR operation.

The help page of this switch can be opened with English WinRAR as follows:

  1. Start WinRAR.
  2. Click in last main menu Help on first menu item Help topics.
  3. Expand on first tab Contents the list item Command line mode.
  4. Expand the list item Switches.
  5. Click on list item "-ilog[name]" - write errors to file.

The manual for the console version Rar.exe is the text file Rar.txt which is stored in the program files folder of WinRAR. It explains the general syntax, the RAR commands and the switches which can be used with Rar.exe and the exit values.

Most switches are supported by WinRAR.exe and Rar.exe, but some switches are supported only by Rar.exe while other switches are supported only by WinRAR.exe. So it is advisable to read either Rar.txt on using Rar.exe or the WinRAR help (file WinRAR.chm) on using WinRAR.exe.

The square brackets [ and ] around the name is the syntax for an optional string which is in this case the file name of the log file without or with a path.

English Rar.txt describes for the option -ilog:

-ilog[name]
        Log errors to file.

        Write error messages to rar.log file. If optional 'name'
        parameter is not specified, the log file is created
        using the following defaults:

        Unix:    .rarlog file in the user's home directory;
        Windows: rar.log file in %APPDATA%\WinRAR directory.

        If 'name' parameter includes a file name without path,
        RAR will create the log file in the default directory
        mentioned above using the specified name. Include both path
        and name to 'name' parameter if you wish to change
        the location of log file.

        By default, log file uses UTF-16 little endian encoding,
        but it can be changed with -sc<charset>g switch, such as -scag
        for native single byte encoding.


        Example:

        rar a -ilogc:\log\backup.log backup d:\docs

        will create c:\log\backup.log log file in case of errors.

So the usage of just -ilog without file name results in writing the error messages into file rar.log in directory %APPDATA%\WinRAR on Windows or in program files directory of WinRAR on not using a WinRAR application data directory and the program files directory of WinRAR is not write-protected for the current user.

-ilogError.txt writes the error messages into the file Error.txt in the current directory.

If the file name without or with path contains a space or one of these characters &()[]{}^=;!'+,`~, the entire switch or the entire file name must be enclosed in ". For example, if the error message should be written into the file Errors.txt in already existing directory C:\Temp\Development & Test(!), there must be used either

"-ilogC:\Temp\Development & Test(!)\Errors.txt"

or

-ilog"C:\Temp\Development & Test(!)\Errors.txt"

Enclosing the entire switch in double quotes is the recommended syntax.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .