gpt4 book ai didi

powershell - 什么是 PowerShell 中的可扩展字符串

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

在 PowerShell 的 documentation , 我遇到了表达式 expandable string:

Argument mode is designed for parsing arguments and parameters for commands in a shell environment. All input is treated as an expandable string unless it uses one of the following syntaxes:

不幸的是,我找不到可扩展字符串 的定义,我的问题是:PowerShell 中的可扩展字符串 是什么?

最佳答案

绝对不幸的是,在撰写本文时,有关 PowerShell 字符串文字的官方帮助主题 about_Quoting_Rules不引入术语可扩展字符串 [更新:在线版本现在引入;要在本地也看到更新,您可能必须运行 Update-Help ].

可扩展字符串是:

  • 双引号 字符串文字 ( "..." )

    • 相比之下,引号字符串 ( '...' ) 是逐字(文字)字符串。
    • 有关所有类型的 PowerShell 字符串文字的概述,包括 here-string 变体(例如 @"<newline>...<newline>"@ ),请参阅 this answer 的底部部分.
  • 双引号字符串执行字符串插值(扩展)

    • 这允许您按原样嵌入简单的变量引用(例如 "$var" ),并通过 $() 嵌入表达式和整个语句。 (例如,"$($var.property)")。 逐字转义 $ (和 " )个字符。与 ` .将变量名称括在 {...} 中用于消除歧义(例如 "${var}" )。
    • 有关完整规则,请参阅 this answer .

关于powershell - 什么是 PowerShell 中的可扩展字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65253528/

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