![]() The batch file finds out automatically where WinRAR.exe is installed working also for those use cases with 32-bit or 64-bit WinRAR not being installed in default program files directory (as on all of my computers). The working directory can be specified as first argument on calling the batch file which can be even a UNC path. ![]() This smart approach is used in the batch file below which contains following additional features to make it useful for hopefully many WinRAR users: It is much more efficient to first extract all *.rar (and later also all *.zip) files using just one WinRAR call with switch -ad to extract each archive file into a subdirectory with name of the archive file and second eliminate each extraction directory not being necessary because the corresponding archive file contained just a single directory at top level. However, that does not really matter as it would be inefficient to first parse an archive file for file and directory names and then use the appropriate command to extract the archive file without or with specifying an extra extraction folder on command line. So it is not really possible to determine from command line or within a batch file if an archive file contains at top level just a single directory on using WinRAR.exe. It can be seen on looking on list of Commands that WinRAR.exe does not support a command l to output archive file contents to a console window because of being a graphic user interface application. On help tab Contents there is the list item Command line mode with all necessary information in referenced help pages for running WinRAR.exe from command line. The manual for WinRAR.exe is the help of WinRAR which can be opened on clicking in menu Help on menu item Help topics on running WinRAR. To support also ZIP archives it is necessary to use GUI version WinRAR.exe which supports extraction of RAR and ZIP archives and some other archive types. But Rar.exe supports like free UnRAR.exe just RAR archives. The list output on running Rar.exe with command l (or L) could be processed in a batch file to determine if the RAR archive file contains at top level just a single directory and nothing else. The console version Rar.exe has the command l to list archive file contents according to text file Rar.txt in program files folder of WinRAR being the manual for console version.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |