Help with TC button parameter for WINRAR

English support forum

Moderators: Hacker, petermad, Stefan2, white

leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Help with TC button parameter for WINRAR

Post by *leo007 »

Hi all,
I found a useful WINRAR TC button parameter command to extract Archive HERE:

Code: Select all

x %P%N "%P"
viewtopic.php?t=22677

now I'm looking for WINRAR TC button parameter command that adds selected files to archive HERE.
it replicates the functionality of WINRAR context menu "Add to <archive name>".

Could be great if anyone could help
Many thanks for help in advance :)
User avatar
xxxdo1
Junior Member
Junior Member
Posts: 87
Joined: 2024-11-03, 02:45 UTC

Re: Help with TC button parameter for WINRAR

Post by *xxxdo1 »

Do you want to unpack the file? You can use cm_UnpackFiles.

Code: Select all

cmd=cm_UnpackFiles
param=/T="D:\path123\" /W="" /G
This is the command I use, it can select the file and unpack it to the specified path.
D:\path123\, change it to the path you want.
User avatar
petermad
Power Member
Power Member
Posts: 16001
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Help with TC button parameter for WINRAR

Post by *petermad »

2leo007

You can use these parameters:

Code: Select all

a %P%O.rar @%WF
It will add selected files to a rar file with the name as the file under the cursor. If the rar file already exist, place the cursor on it. If the rar file does not exist place the cursor on a file with the name you want to give the rar file. If you place the cursor on [..] you wil get a file with the name .rar
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Help with TC button parameter for WINRAR

Post by *Horst.Epp »

I use this button

Code: Select all

TOTALCMD#BAR#DATA
"C:\Program Files\WinRAR\winRar.exe"
a  -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%T\%B".rar @%UL
C:\Program Files\WinRAR\WinRAR.exe
Pack selected as RAR (full paths) 

0
-1
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

2xxxdo1
xxxdo1 wrote: 2024-11-08, 00:47 UTC Do you want to unpack the file? You can use cm_UnpackFiles.

Code: Select all

cmd=cm_UnpackFiles
param=/T="D:\path123\" /W="" /G
This is the command I use, it can select the file and unpack it to the specified path.
D:\path123\, change it to the path you want.
thank you for the code, but I was looking for opposite action "adds selected files to archive HERE" :)

2petermad
petermad wrote: 2024-11-08, 02:29 UTC a %P%O.rar @%WF
thanks for the code, When I try to run it with the attached parameter, I get the following WINRAR error:
https://i.imgur.com/kUl24JL.png

2@Horst.Epp
Horst.Epp wrote: 2024-11-08, 08:23 UTC a -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%T\%B".rar @%UL
thank you for the code, it adds selected files to archive, but unfortunately like TC cm_PackFiles archive will appear in second panel and not Here (current panel location)
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Help with TC button parameter for WINRAR

Post by *Horst.Epp »

leo007 wrote: 2024-11-08, 13:16 UTC
2@Horst.Epp
Horst.Epp wrote: 2024-11-08, 08:23 UTC a -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%T\%B".rar @%UL
thank you for the code, it adds selected files to archive, but unfortunately like TC cm_PackFiles archive will appear in second panel and not Here (current panel location)
That's easy to fix
Replace %T with %P
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

Horst.Epp wrote: 2024-11-08, 14:31 UTC That's easy to fix
Replace %T with %P
Perfect! Many Many thanks 🥳
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

2Horst.Epp one thing, when I add to archive file "item.txt"
d:\Downloads\Folder A\item.txt

it adds the whole root folder tree structure to the archive Along with the file,
d:\Downloads\Folder A_20241108175147.rar\Downloads\Folder A\item.txt

How can it be modified so that only the selected file is added to the archive without root folder tree structure ?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Help with TC button parameter for WINRAR

Post by *Horst.Epp »

leo007 wrote: 2024-11-08, 16:02 UTC How can it be modified so that only the selected file is added to the archive without root folder tree structure ?
Replace the @%UL with %S and add -ep1 on the line.
So it looks like this
a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P\%B".rar %S
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

by replacing the @%UL with %S I have the following error
https://i.imgur.com/VimGzu3.png

the parameter line now is: a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P\%B".rar %S
Did I write anything incorrectly?
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3893
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Help with TC button parameter for WINRAR

Post by *sqa_wizard »

Well you have a double backslash "\\"

Try: a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P%B".rar %S
#5767 Personal license
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

2sqa_wizard
thank you for the code, just tried it but the same WINRAR error popup appears
User avatar
petermad
Power Member
Power Member
Posts: 16001
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Help with TC button parameter for WINRAR

Post by *petermad »

2petermad

petermad wrote: ↑Friday 08-11-2024, 03:29:31
a %P%O.rar @%WF

thanks for the code, When I try to run it with the attached parameter, I get the following WINRAR error:
https://i.imgur.com/kUl24JL.png
It looks like you are inside test.rar when you use the command - you have to place the cursor ON test.rar but NOT press Enter to go into it. And you have to mark some files.

Here is the button I tested with:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\PACKERS\RAR\WinRAR.exe
a %P%O.rar @%WF
wcmicons.dll,30
Add selected files to RAR archive with name as file under cursor


-1
You have to change the path in the WinRAR.exe line to your path.
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
leo007
Junior Member
Junior Member
Posts: 42
Joined: 2019-10-28, 08:09 UTC

Re: Help with TC button parameter for WINRAR

Post by *leo007 »

petermad wrote: 2024-11-08, 21:09 UTC
2petermad

petermad wrote: ↑Friday 08-11-2024, 03:29:31
a %P%O.rar @%WF

thanks for the code, When I try to run it with the attached parameter, I get the following WINRAR error:
https://i.imgur.com/kUl24JL.png
It looks like you are inside test.rar when you use the command - you have to place the cursor ON test.rar but NOT press Enter to go into it. And you have to mark some files.

Here is the button I tested with:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\PACKERS\RAR\WinRAR.exe
a %P%O.rar @%WF
wcmicons.dll,30
Add selected files to RAR archive with name as file under cursor


-1
You have to change the path in the WinRAR.exe line to your path.
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
Thank you for the heads-up! it works great now :)
Your previously suggested parameter was exactly the same, so I was trying to compare to understand why it is working now.
In addition to WinRAR path "%PROGRAMFILES%/WinRAR/WinRAR.exe", I always used to add the "Start path: "%PROGRAMFILES%/WinRAR/
turn out it was the cause of the error.

I always thought the Start path should be added, but it seems that I was mistaken.
It would be great to know when it is appropriate to add the Start path and when it is not?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Help with TC button parameter for WINRAR

Post by *Horst.Epp »

sqa_wizard wrote: 2024-11-08, 18:08 UTC Well you have a double backslash "\\"

Try: a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P%B".rar %S
No, no need for this.
This line works perfectly in my button and the actual WinRAR 7.10 and TC 10.50b5
a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P\%B".rar %S

It creates the archive in the source folder as requested and adds date and time to the name.
One can omit the \ after %P as this is added by TC.
So this also works for me
a -ep1 -os -m5 -tl -ag"_YYYYMMDDHHMMSS" "%P%B".rar %S
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Post Reply