I use WinRar.
In Options > Settings > Integration > User defined archive extensions, I've associated XPI and JA files (Firefox add-ons and omni.ja) with the program.
I would like to add the following entries to Windows Explorer's context menu:
1) Compress to "FileName.xpi"
2) Compress to "FileName.ja"
I'd like the entries to appear below the default "Compress to 'FileName.zip'", and also the compression format to be in my zip settings.
*
I've googled and created a batch file. For the time being, the file is placed in 'Send to'.
If I use the following code:
Code: Select all
for %%* in (.) do set CurrentFolder=%%~n*
"C:\Program Files\WinRar\WinRar" a -afzip -r "%CurrentFolder%.xpi"
The file name is that of the current folder (correct).
All files and folders are archived whether I select one item or multiple items (wrong).
If I use the following code:
Code: Select all
set file=%~f1
"C:\Program Files\WinRar\WinRar" a -afzip "%file:~0,-4%.xpi" %1
The file name is that of the file on which I right-click (correct).
Only that file is archived even if multiple files are selected (wrong).
If I right-click a folder, the code should be different (wrong).
I'm not familiar with batch coding.
How can I know if a single item is selected or more?
What's the condition syntax?
(Win 7, 32 bit).
I'd appreciate your help.