Invoke PowerShell from the Command Line with Parameters

Mark Berry November 5, 2014

There don’t seem to be too many examples of invoking PowerShell from the command line when the PowerShell command itself has parameters. Here’s one that should work (with a line break to fit it to the column width here):

powershell.exe -NoLogo -NoProfile -NonInteractive
.\'MCB.Save Params.ps1'
-Param1 '' -Param2 'Router'

This should be run in the directory containing the script. Note that if the script name includes spaces, you’ll need to enclose the name in quotes—but put the opening quote after the .\.

Leave a Reply