开发者

Powershell analog to 'quote words'

开发者 https://www.devze.com 2022-12-10 21:15 出处:网络
What is the Powershell equivalent to Perl\'s qw() function? In v2 I 开发者_高级运维can write my own with -split, but I\'m assuming that there\'s an exiting method that I just can\'t find in the docume

What is the Powershell equivalent to Perl's qw() function? In v2 I 开发者_高级运维can write my own with -split, but I'm assuming that there's an exiting method that I just can't find in the documentation.


We include this functionality in the PowerShell Community Extensions e.g.:

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

If you don't want to install PSCX, the function is trivial:

Set-Alias ql Quote-List
function Quote-List {$args}


The built-in Write-Output cmdlet (standard alias write) works this way because the -InputObject param accepts all remaining arguments.

PS> write one two three
one
two
three
0

精彩评论

暂无评论...
验证码 换一张
取 消