代码之家  ›  专栏  ›  技术社区  ›  Justin R.

PowerShell模拟到“引号字”

  •  3
  • Justin R.  · 技术社区  · 15 年前

    PowerShell等同于Perl的qw()函数是什么?在v2中,我可以编写自己的with-split,但我假设有一个现有的方法,在文档中找不到。

    2 回复  |  直到 6 年前
        1
  •  3
  •   Keith Hill    15 年前

    我们将此功能包括在 PowerShell Community Extensions 例如。:

    PS> quote-list hello world
    hello
    world
    PS> ql hello world  # using alias
    hello
    world
    

    如果您不想安装pscx,那么这个功能很简单:

    Set-Alias ql Quote-List
    function Quote-List {$args}
    
        2
  •  0
  •   brianary    6 年前

    内置的 Write-Output Cmdlet(标准别名 write )这样工作是因为 -InputObject param接受所有剩余参数。

    PS> write one two three
    one
    two
    three