【问题标题】:Get-Help about_Automatic_Variables not workingGet-Help about_Automatic_Variables 不起作用
【发布时间】:2016-11-17 11:47:36
【问题描述】:

我正在研究 PowerShell,无论是在网站上还是在书籍上,建议调用 Get-Help about_Automatic_Variables 以获取返回的自动变量列表。我尝试使用以下参数调用 Get-Help,但我总是得到一个返回的 cmdlet 列表:

  • about_Variables
  • about_Automatic_Variables
  • about_Environment_Variables
  • about_Preference_Variables
  • about_Scopes

我弄错了什么?

【问题讨论】:

  • 我可以在 v5 中重现这个。它不是 about_Automatic_Variables,因为我从 `get-help about_Automatic_Vari.我不知道这是否是一个错误。需要更多调查。

标签: powershell


【解决方案1】:

您可能需要更新您的帮助

Update-Help

那么您应该可以使用以下方法检索它:

get-help about_Automatic_Variables

【讨论】:

  • 是的。他的帮助并不完整。 Get-Help "about_*" 应该证明这一点。他得到的结果仍然很奇怪。
  • 我确认执行Get-Help "about_*" 不会列出about_Automatic_Variables。我以管理员身份重复了update-help,继续处理错误,但现在仍然没有列出about_Automatic_Variables。我错过了什么或做得不对?
  • 最后我在powershell.org/forums/topic/…找到了我的问题的解决方案。执行Install-Script -Name Install-AboutHelpInstall-AboutHelp.ps1,你会得到缺少的 about_* 帮助文件。
  • 感谢分享。您可以将此添加为答案并接受它以帮助其他人。
【解决方案2】:

所以the solution from powershell.org 是:

Install-Script -Name Install-AboutHelp

在管理员 powershell 中获取丢失的帮助文件。

【讨论】:

  • 我也会在答案中包含指向您获得此信息的链接。因为 cmets 不会永远存在。
  • 我使用的是 PS 7.1 Core 但它不起作用,链接也不起作用:Get-Help: Get-Help could not find about_automatic_variables in a help file..Install-Script install-abouthelp 最喜欢工作了。
【解决方案3】:

阅读:

https://technet.microsoft.com/en-us/library/hh847768.aspx

我从我的浏览器得到这个。当我搜索“关于自动变量”时,这是第一次点击。正如另一个答案中所建议的那样,更新您的 PS 副本中的帮助不会有什么坏处。对于当前变量的列表,只需这样做:

PS> gci variable:

【讨论】:

    【解决方案4】:

    您可能有除英语集和 Powershell V5 以外的语言吗? 如果是 - 这就是你的答案 Missing Help Files in Powershell V5.0

    【讨论】:

    • 我的文化是 en-us,即使在 update-help 之后(顺便说一句,在更新 SqlServer 模块时中断并停止),行为仍然保持不变,可能与@Matt 看到的相同,cmdlet 列表返回以 ForEach-Object 开头。
    猜你喜欢
    • 2018-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多