Home Forums Programming Powershell Powershell: Passing variables to scriptfile using invoke-sqlcmd RE: Powershell: Passing variables to scriptfile using invoke-sqlcmd

  • I cannot sum it up any better than this DevCentral article.

    Just in case the link ever goes here is an example of a named parameter (must be the first line of the script):

    param([string]$namedArgument="default")

    # Defaults to the text "default" if not present.

    Write-Host $namedArgument

    Or using the standard $args variable:

    Write-Host $args[0]

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!