Use %L with WinRar but failed, what's wrong?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
pikashi
Junior Member
Junior Member
Posts: 3
Joined: 2012-02-16, 09:01 UTC

Use %L with WinRar but failed, what's wrong?

Post by *pikashi »

I want to create a button to comment all the selected .rar and .zip files,
here is my button settings:

Code: Select all

command line: 
"C:\Program Files\WinRAR\WinRAR.exe"
parameters: 
c -z"D:\Pikashi\comment.txt" @%L
It did not work but only popups a warning window.

Also I tried this command:

Code: Select all

command line: 
"C:\Program Files\WinRAR\WinRAR.exe"
parameters: 
c -z"D:\Pikashi\comment.txt" %P%N
But this only add comment to 1 file.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

What kind of warning it pops up? Is WinRar really able to comment multiple files at once?

You can always try a batch that will call WinRar for every selected file separately:

Code: Select all

@echo off 
if -%1==- echo Parameters: "%%WL" ^<comment_file^> & pause & goto :EOF
for /f "usebackq" %%f in (`type %1`) do call :loop_body "%%~dpnxf" "%~2"
:after_loop
pause
goto :EOF

:loop_body
"C:\Program Files\WinRAR\WinRAR.exe" c -z%2 %1
Button for it:

Code: Select all

Command: path to bat file
Parameters: "%WL" "D:\Pikashi\comment.txt"
Edit: %WL quoted.
Last edited by MVV on 2018-07-19, 12:27 UTC, edited 1 time in total.
pikashi
Junior Member
Junior Member
Posts: 3
Joined: 2012-02-16, 09:01 UTC

Post by *pikashi »

@MVV
Thank you!
I think the reason is WinRAR do not support multiple files with comment command.

Also I've made my batch script:

Code: Select all

@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('type "%1"') do (
  echo "%%a"|findstr /r "\.zip \.rar">nul
  if !errorlevel! equ 0 (
    start "" "%Programfiles%\\Winrar\\winrar.exe" c -z"D:\\Pikashi\\comment.txt" "%%a"
  )
)
pause
And the button:

Code: Select all

command line:
path to the batch script file
parameters:
%L
Last edited by pikashi on 2018-07-19, 07:45 UTC, edited 1 time in total.
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

For other readers:

:idea:

%L and %WL and so on, are substituted by a path to the users temp folder.
So use quotes here ("%L") if your user name contains space.




 
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Also, it is better to use %WL instead of %L to get rid of Unicode problems, it is supported by for loop with type command.
Post Reply