我最近将Windows 10升级到版本1903,但是在遇到一些问题并联系Microsoft技术支持后,我已经重置了Windows。现在我正在尝试重新安装重置之前安装的所有内容,其中之一是Chocolatey(Windows的软件包管理器(。
我尝试运行两个安装命令:
(对于CMD(
@"%SystemRoot%System32WindowsPowerShellv1.0powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin"
(适用于PowerShell(
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
但是每次我收到此错误时:
Exception calling "Start" with "0" argument(s): "The specified executable is not a valid application for this OS
platform."
At C:UsersehsanDownloadsinstall.ps1:206 char:3
+ $process.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Exception calling "BeginOutputReadLine" with "0" argument(s): "StandardOut has not been redirected or the process
hasn't started yet."
At C:UsersehsanDownloadsinstall.ps1:207 char:3
+ $process.BeginOutputReadLine()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At C:UsersehsanDownloadsinstall.ps1:208 char:3
+ $process.WaitForExit()
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install
again. Error: 7-Zip signalled an unknown error (code )
At C:UsersehsanDownloadsinstall.ps1:220 char:15
+ ... default { throw "$errorMessage 7-Zip signalled an unknown error (co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...n error (code ):String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompres
sion = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
我还尝试下载install.ps1
脚本并手动运行它(当然,在将执行策略设置为绕过之后(,但结果与上述相同。值得一提的是,我以管理员身份运行cmd和PowerShell进行安装。顺便说一句,我还没有尝试离线安装,因为我无法弄清楚说明的内容。
谷歌搜索错误并没有帮助我找到解决方案。
我遇到了同样的问题(至少消息完全相同(。我在更受控的环境中安装了巧克力,也就是说,由于某些安全策略原因,不允许执行脚本的某些部分。
错误在于,在PowerShell的第192行,它试图下载EXE文件:
Download-File 'https://chocolatey.org/7za.exe' "$7zaExe"
这在我的环境中是不允许的,因此由于我已经在我的Windows上安装了Zip,我只需将所需的文件(7az.exe(复制并重命名到install.ps1(Powershell脚本(正在寻找的文件夹中。
就我而言:
C:Users%USER%AppDataLocalTempchocolateychocInstall7za.exe
因此,将 ZIP exe 文件放在此路径上,使用此名称,一切正常。
干杯