I have a PowerShell script with a list of commands defined in it. And I am trying to Create a build step in Gitlab CI when run, executes the particular script. For this I want to first Understand: How to run specific commands/functions of Powershell from Command line?
I have read Invoking a specific function from PowerShell script from C# and Calling Powershell functions from C#
The answers are specific to C#. Is there any way I can do it from the command line?
Code looks somewhat like this (myPowerScript.ps1) I have more than One function in my powershell script. It is something like:
function foo1{
Param($Parameter1,
$Parameter2)#
# Foo1 implementation
}
function foo2{
Param($Parameter1,
$Parameter2)#
# Foo2 implementation
}
function foo3{
Param($Parameter1,
$Parameter2)#
# Foo3 implementation
}
I want to invoke foo2: How do I do it? and in this case, how does PowerShell understand which function is invoked?