windows 如何从命令行中提取自解压 exe
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9194589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to extract a self extracting exe from commandline
提问by prakashjv
Is there a way to extract a self extracting exe from commandline in windows?
有没有办法从 Windows 的命令行中提取自解压 exe?
I have a self extracting exe which is of type RAR. I want to extract the contents of this RAR only with the help of windows and not using any other tools (like 7zip, Unrar etc) which helps to extract. Also, I want to do it from the command line only.
我有一个 RAR 类型的自解压 exe。我只想在 Windows 的帮助下提取此 RAR 的内容,而不使用任何其他有助于提取的工具(如 7zip、Unrar 等)。另外,我只想从命令行执行此操作。
Are there any utilities in windows which I can use to extract the self extracting exe file from commandline?
Windows 中是否有任何实用程序可用于从命令行中提取自解压 exe 文件?
回答by Michael Burr
You might be able to get the self-extacting RAR archive to do what you want with one or more of the following RAR SFX (self-extracting archive) options:
您可以使用以下一种或多种 RAR SFX(自解压存档)选项来获取自解压 RAR 存档来执行您想要的操作:
GUI self-extracting modules support following command line switches:
-d<path> set the destination path -p<pwd> specify a password -s silent mode, hide all -s1 same as -s -s2 silent mode, hide start dialog -sp<par> specify parameters for setup program
GUI 自解压模块支持以下命令行开关:
-d<path> set the destination path -p<pwd> specify a password -s silent mode, hide all -s1 same as -s -s2 silent mode, hide start dialog -sp<par> specify parameters for setup program
I'm not sure if any of these options will suppress running a setup program that the SFX is configured to run.
我不确定这些选项中的任何一个是否会禁止运行 SFX 配置为运行的安装程序。
回答by Kaptnik
Download UnRar for windows (freeware) from this link. It in itself is a self extracting archive, which when installed will give you the actual unrar.exe. You can then use unrar.exe to extract files from the command line.
从此链接下载 Windows 版 UnRar(免费软件)。它本身就是一个自解压档案,安装后会给你真正的 unrar.exe。然后,您可以使用 unrar.exe 从命令行提取文件。
回答by Sabeer Ebrahim
Use unzip utility from http://www.info-zip.org/. It is an open source and binaries are available for all os flavors.
使用来自http://www.info-zip.org/ 的解压缩实用程序。它是一个开源的,二进制文件可用于所有操作系统风格。
unzip command: unzip.exe sample.zip -d extract_folder
解压命令: unzip.exe sample.zip -d extract_folder
Download latest windows executable at ftp://ftp.info-zip.org/pub/infozip/win32/. After downloading the binary like 'unz552xn-x64.exe', run it in command line, it will give a set of files including unzip.exe. since unzip.exe does not have any dependency other files can be deleted.
在ftp://ftp.info-zip.org/pub/infozip/win32/下载最新的 Windows 可执行文件。下载像'unz552xn-x64.exe'这样的二进制文件后,在命令行中运行它,它会给出一组文件,包括unzip.exe。由于 unzip.exe 没有任何依赖项,因此可以删除其他文件。
回答by NoNo
For others that are looking for the answer to this.
对于其他正在寻找答案的人。
Download the trial version or purchase WinRAR. Right click the files you want to package and select add to archive.
下载试用版或购买 WinRAR。右键单击要打包的文件,然后选择添加到存档。
Check "create sfx archive" on the General tab, this will give you the file.exe
在“常规”选项卡上选中“创建 sfx 存档”,这将为您提供 file.exe
Select the "sfx options" on the Advanced tab, under the Modes tab select "hide all". If you don't want the extracted files to show or stay after your program/script has run then "Unpack to temporary folder" under this same tab.
在“高级”选项卡上选择“sfx 选项”,在“模式”选项卡下选择“全部隐藏”。如果您不想在程序/脚本运行后显示或保留提取的文件,请在同一选项卡下“解压缩到临时文件夹”。
Under the Setup tab in the "run after extraction" put the program or script you would like to run.
在“提取后运行”的“设置”选项卡下放置您要运行的程序或脚本。
Once file(s) have been packaged you will have a file called file.exe. (Note:File will be what you named the sfx archive). From command line type file.exe and it will extract to the temp location (if you selected that) and run the program/script that you specified. Once the program/script closes the folder in the temp location will be removed.
文件打包后,您将拥有一个名为 file.exe 的文件。(注意:文件将是您命名的 sfx 存档文件)。从命令行输入 file.exe,它将提取到临时位置(如果您选择了该位置)并运行您指定的程序/脚本。程序/脚本关闭后,临时位置中的文件夹将被删除。
Notes:
笔记:
If running from a WinPe CD or otherwise similar bootable media do not use "Unpack to Temporary Folder".
如果从 WinPe CD 或其他类似的可启动媒体运行,请勿使用“解压到临时文件夹”。
WinRAR only has to be on the computer making the sfx archive. Once the sfx archive is made you won't need it to extract the files.
WinRAR 只需要在制作 sfx 存档的计算机上。制作 sfx 存档后,您将不需要它来提取文件。