我尝试通过CMD解压缩文件。
所以我安装了winzip(及其插件到cmd),winrar和7-zip。
但是当我通过CMD尝试execute a command时:
7z e myzip.zip
它给出了下一个错误:
7z is not recognized as an internal or external command
此外,我将7-z的文件夹添加到环境变量(属性 - >高级 - >环境变量 - >用户变量 - >选择路径,并添加{{1} }
可能是什么原因?
答案 0 :(得分:78)
在命令提示符下执行以下操作对我来说也很有用,同时添加到我的用户环境变量也可以正常工作:
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
答案 1 :(得分:5)
关于Phil Street的帖子:
如果您运行的是64位操作系统,它实际上可能安装在32位程序文件夹中,而不是默认的x64。检查7-zip
的安装位置,如果它位于Program Files (x86)
,请尝试使用此代码:
PATH=%PATH%;C:\Program Files (x86)\7-Zip
答案 2 :(得分:1)
确保您的路径指向C:\ Program Files \ 7-Zip中的.exe文件(可能在bin目录中)
答案 3 :(得分:0)
在Windows 10中,我必须以管理员身份运行批处理文件。