+1

Add parameter option to :ps (poweshell) function

Shawn 6 years ago updated 6 years ago 0

I've been playing with the new :ps function and it's great, but I find that I need to create several scripts where one might be sufficient if the :ps function supported variable input that can be parsed with param(). This could work as:

    {myscript:ps:input1:input2}

    {myscript:ps:[anotherKetarinVariable]:10}


    {myscript:ps:[startuppath]}

These could be parsed with the following in your powershell script variable:

    param (
        [string]$param1 = "https",
        [string]$param2 = "5"
    )

Values in square brackets (or some other acceptable predefined syntax) would be replaced with the values of the existing variable.

This would greatly increase the utility of the :ps function.