How can I access all parameters in PowerShell like in bash with $* ?
-
1Do you mean $args variable?Yevgeniy.Chernobrivets– Yevgeniy.Chernobrivets2013-12-07 18:34:26 +00:00Commented Dec 7, 2013 at 18:34
-
yeah i need all of them :D args[0] args[1]... if its possible i need them in one expression like $* in bashszarkabarna– szarkabarna2013-12-07 18:37:38 +00:00Commented Dec 7, 2013 at 18:37
Add a comment
|
3 Answers
There are a few ways to do this:
- $args will have arguments, but only if they script doesn't have any named arguments. If it does, $args will be blank.
- $psBoundParameters will have the bound parameters for the current function. This will show you the values provided for a script file or function, but it won't show you a default value.
- If you're dealing with Pipelined input, $_ and $input will contain the input from the pipeline.
The way you've written the question, it also makes me wonder if you're trying to get all variables defined. If this is what you're after, you'd use Get-Variable.