gpt4 book ai didi

powershell - Find-Package没有-ScriptSourceLocation参数

转载 作者:行者123 更新时间:2023-12-03 00:06:54 25 4
gpt4 key购买 nike

为什么Find-Package无法识别-ScriptSourceLocation参数?

PS H:\> help Find-Package -Full
NAME
Find-Package

SYNOPSIS
Finds software packages in available package sources.


SYNTAX
Find-Package [[-Name] <String[]>] [-AcceptLicense] [-AllowPrereleaseVersions] [-AllVersions] [-Command <String[]>] [-Credential <PSCredential>]
[-DscResource <String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-IncludeDependencies] [-Includes {Cmdlet | DscResource | Function |
RoleCapability | Workflow}] [-MaximumVersion <String>] [-MinimumVersion <String>] [-PackageManagementProvider <String>] [-ProviderName {Bootstrap |
NuGet | PowerShellGet}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RequiredVersion <String>] [-RoleCapability
<String[]>] [-ScriptPublishLocation <String>] ***[-ScriptSourceLocation <String>]*** [-Source <String[]>] [-Tag <String[]>] [-Type {Module | Script | All}]
[<CommonParameters>]

但是,如果使用异常,则会产生异常。
PS H:\> Find-Package -ProviderName 'NuGet' -ScriptSourceLocation 'https://www.powershellgallery.com/api/v2/items/psscript'
Find-Package : A parameter cannot be found that matches parameter name 'ScriptSourceLocation'.
At line:1 char:36
+ Find-Package -ProviderName 'NuGet' -ScriptSourceLocation 'https://www ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Find-Package], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

最佳答案

我认为您在这里看到的是一个错误,要么是Find-Package,要么是带有命名参数集的怪癖/错误。我会在Powershell Core issue page上报告此问题,因为当前版本的PowerShell 6仍然存在问题。进一步的测试表明,如果您不指定-ProviderName,则该参数可以正常工作并且可以被识别。

关于powershell - Find-Package没有-ScriptSourceLocation参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59472531/

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