How to extract ZIP files with WinRAR command line?

喜欢而已 提交于 2019-12-03 05:17:52
user2874632

Free unrar.exe and console versionRar.exe of WinRAR support only RAR archive format. That is clearly described in second paragraph in manual for Rar.exe which is the text file Rar.txt in program files folder of WinRAR.

You need to use WinRar.exe instead which supports also other archive formats:

[path\winrar.exe] x [switches] [path to zip file] [files to extract, . for all files] [path folder to extract to]

Example:

"%ProgramFiles%\WinRAR\winrar.exe" x -ibck c:\file.zip *.* c:\folder\

The syntax, commands and switches for GUI version WinRAR.exe are listed and described in help of WinRAR. Click in menu Help on menu item Help topics, open on help tab Contents the item Command line mode and read the help pages listed under this item.

For example the switch -ibck supported only by WinRAR.exe but not by Rar.exe is for running the extraction in background which means GUI version of WinRAR makes the extraction minimized to an icon in Windows system tray.

rar.exe can indeed only unpack rar files. It's not at all the same as WinRAR.

For unpacking ZIP files in .NET, you might want to look at the DotNetZip library instead. It has a license compatible with commercial software, unlike CSharpZipLib.

If you need to support RAR as well, you can use UnRAR.dll with pinvoke:
http://www.rarlab.com/rar_add.htm
http://www.rarlab.com/rar/UnRARDLL.exe

Or this .NET unRAR libary:
http://www.chilkatsoft.com/rar-dotnet.asp

Perhaps this one for 7zip.

You can use either SevenZipSharp or DotNetZip Library in your Application!

But I will go for SevenZipSharp Lib as It supports all the archives supported by 7-Zip!

Both Source and Binary are available in the Links!

Stefano Carfagna
for /f "tokens=*" %G in ('dir /on /b "D:\BACKUP_DATI\EXCEL\OPER*.ZIP"') do "C:\Program Files\7-Zip\7z.exe" x  "..\%G" –aoa

References to further reading:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!