In powershell, how to build String arrays from “remaining” arguments passed from command line? [duplicate]
问题 This question already has an answer here : Can I Pass Arguments To A Powershell Function The Unix Way? (1 answer) Closed 10 days ago . It is inconvenient to type ("arg0", "arg1", "arg2") on the command line when a function needs a String array. Like in this example: function Exec-GradleScript( [Parameter(Mandatory)]String] $ScriptName [Parameter(Mandatory)][String[]] $ArgList ){ & "$ScriptName" $ArgList } ... all the arguments after -ScriptName need to be in the explicit array syntax. How can