gpt4 book ai didi

powershell - Powershell 3.0 中的与号行为是否发生了变化?

转载 作者:行者123 更新时间:2023-12-05 00:36:24 24 4
gpt4 key购买 nike

安装 windirstat 时出现以下错误和 ilmergeChocolatey .我怀疑 PowerShell 3.0 中的&符号行为发生了变化。

Running powershell -NoProfile -ExecutionPolicy unrestricted -Command "& import-module -name  'C:\NuGet\chocolateyInstall\helpers\chocolateyInstaller.psm1'; & 'C:\NuGet\lib\ilmerge.2.10.526.4\tools\chocolateyInstall.ps1'". This may take awhile and permissions may need to be elevated, depending on the package.
ilmerge did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] The expression after '&' in a pipeline element produced an invalid object. It must result in a command name, script block or Command
Info object.
-----------------------

最佳答案

问题不是我必须替换的&符号行为 $oc = Get-Command 'Write-Host' | ?{$_.ModuleName -eq 'Microsoft.PowerShell.Utility'}$oc = Get-Command 'Write-Host' -Module 'Microsoft.PowerShell.Utility'以及对 Write-Error 包装器进行类似的替换。

关于powershell - Powershell 3.0 中的与号行为是否发生了变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8112642/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com