Any way to specify a non-positional parameter in a powershell script?
Posted
by Julian Birch
on Stack Overflow
See other posts from Stack Overflow
or by Julian Birch
Published on 2010-05-08T20:53:25Z
Indexed on
2010/05/08
20:58 UTC
Read the original article
Hit count: 214
powershell
I've got the following at the start of a script
Param( [string]$command, [string]$version = "1.1.0" )
This is fine, only I need for $version to not be a positional parameter, so that if you type
.\script.ps1 run argument
Then $args should contain argument and $version should be 1.1.0.
Is this even possible? I know I can do it with a c# cmdlet, but it would be massively more convenient if I could deliver this as a single script.
© Stack Overflow or respective owner