解压缩文件(7-ZIP)经由cmd命令(Unzip files (7-zip) via cmd co

2019-07-17 18:31发布

我尝试解压缩通过CMD文件。

所以我安装的WinZip(及其插件CMD),WinRAR和7-ZIP。

但是,当我尝试执行命令通过CMD:

7z e myzip.zip

它给下一个错误:

7z is not recognized as an internal or external command

另外,我加了7-Z的文件夹到环境变量(属性- >高级- >环境变量- >用户变量- >选择路径,并添加C:\Program Files\7-Zip

可能是什么原因?

Answer 1:

在命令提示符下执行以下工作对我来说,也增加了我的用户环境变量运行良好,以及:

set PATH=%PATH%;C:\Program Files\7-Zip\
echo %PATH%
7z

您应该看到作为输出(或类似的东西 - 因为这是我的笔记本电脑运行Windows 7):

C:\Users\Phillip>set PATH=%PATH%;C:\Program Files\7-Zip\

C:\Users\Phillip>echo %PATH%
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Wi
ndows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\
WirelessCommon\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\To
ols\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fil
es (x86)\QuickTime\QTSystem\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Notepad+
+;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\7-Zip\

C:\Users\Phillip>7z

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths
<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -ssw: compress shared files
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries


Answer 2:

关于菲尔街的帖子:

它实际上可能被安装在您的32位程序文件夹,而不是默认的64,如果你正在运行64位操作系统。 检查看到7-zip安装,如果是在Program Files (x86)然后尝试用这个来代替:

PATH=%PATH%;C:\Program Files (x86)\7-Zip


Answer 3:

确保你的路径指向.EXE在C文件:\ Program Files文件\ 7-Zip的(可能在bin目录下)



Answer 4:

在Windows 10,我不得不运行该批处理文件作为管理员。



文章来源: Unzip files (7-zip) via cmd command
标签: cmd 7zip winzip