I've created a batch file for zipping selected items in a folder.
(The file is placed in 'Send to').
If I use the following code:
for %%* in (.) do set CurrentFolder=%%~n* "C:\Program Files\WinRar\WinRar" a -afzip "%CurrentFolder%.xpi"
set file=%~f1 "C:\Program Files\WinRar\WinRar" a -afzip "%file:~0,-4%.xpi" "%1"
How can I know if a single item is selected or more?
What's the condition syntax?
How can I include folders in the archive?
Thank you.
(The file is placed in 'Send to').
If I use the following code:
for %%* in (.) do set CurrentFolder=%%~n* "C:\Program Files\WinRar\WinRar" a -afzip "%CurrentFolder%.xpi"
- The file name is that of the current folder (correct).
- All files are archived whether I select one file or multiple files (wrong).
- Selected folders are not archived (wrong).
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).
How can I know if a single item is selected or more?
What's the condition syntax?
How can I include folders in the archive?
Thank you.