如何使用WinRAR命令行解压ZIP文件? [英] How to extract ZIP files with WinRAR command line?

查看:2649
本文介绍了如何使用WinRAR命令行解压ZIP文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试解压缩zip文件时出现错误:

While trying to extract zip files I get the error:


c:\path\\\
ame.zip不是RAR压缩文件

无法提取的文件

c:\path\name.zip is not RAR archive
No files to extract

我的代码是:

p.StartInfo.FileName = @"C:\Program Files\WinRAR\rar.exe";
p.StartInfo.Arguments = string.Format("x -o- {2} \"{0}\" * \"{1}\"\\ ",
  szFN,
  outFolder,
  passWord == null ? "" : string.Format("-p\"{0}\"", passWord));

GUI版本可以解压缩zip和7z文件。

The GUI version can extract zip and 7z files.

为什么这不工作?我如何提取zip和7z文件?

Why doesn't this work? How can I extract zip and 7z files?

(注意:我有不同的源代码为7zip。我想我可以合并这两个,只有使用上面的文件有一个rar扩展,但我不喜欢这个解决方案。)

(NOTE: I have different source code for 7zip. I guess I can merge the two and only use the above when the file has a rar extension. But I don't like that solution.)

推荐答案

Free unrar.exe 和控制台版本 Rar.exe WinRAR 仅支持RAR压缩格式。这在 Rar.exe 的手册中的第二段中清楚地描述,它是程序文件中的文本文件 Rar.txt

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.

您需要使用 WinRar.exe 其他文件格式:

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


[path\winrar.exe] x [switches] [zip文件的路径] em>。所有文件] [要解压到的路径文件夹]

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

示例:

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

GUI版本的语法,命令和开关 WinRAR.exe WinRAR 的帮助下列出和描述。点击菜单帮助主题中的帮助,在帮助标签内容中打开命令行模式

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.

例如, -ibck 开关仅支持 WinRAR.exe 但不是 Rar.exe 是用于在后台运行提取,这意味着GUI版本的 WinRAR 使提取最小化到Windows系统托盘中的图标。

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.

这篇关于如何使用WinRAR命令行解压ZIP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆