Quantcast
Viewing all articles
Browse latest Browse all 6058

Command line - Some questions

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"
  • 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).
If I use the following code:
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.

Viewing all articles
Browse latest Browse all 6058

Trending Articles